$strName = "http://lineage2.enet.com.cn/stores/images/pic1063776814491.jpg";
echo $strVal = substr(strrchr ($strName, "/"), 1, strlen($strName));

解决方案 »

  1.   

    $pa_url=$_SERVER["PHP_SELF"]; //你的url
        $aa_url=explode("/",$pa_url);
        $img=$aa_url[3];
      

  2.   

    补充一下,$aa_url[]根据$pa_url中的/来决定。
      

  3.   

    $strName = "http://lineage2.enet.com.cn/stores/images/pic1063776814491.jpg";
    echo  basename($strName);
      

  4.   

    $str = "http://lineage2.enet.com.cn/stores/images/pic1063776814491.jpg";
    $str = explode('/',$str);
    echo end($str);
      

  5.   

    多谢两位
    zkfjw(gardner) 的办法可以
    wen8u8(赖皮猫) 的办法在这个地址里行,但是如果目录不是3层就不行了,$aa_url[3]就不是取的最后的地址了
    结贴了
      

  6.   

    $str = "http://lineage2.enet.com.cn/stores/images/pic1063776814491.jpg";
    echo basename($str);
      

  7.   

    刚看到ashchen(陈辉) 的
    这种用法倒是学到了,谢谢
      

  8.   

    用basename()函数速度比较快---------- PHP ----------
    Content-type: text/html
    X-Powered-By: PHP/4.3.8pic1063776814491.jpg   8.0999999999998E-005
    pic1063776814491.jpg   1.8000000000018E-005输出完成 (耗时 0 秒) - 正常终止
      

  9.   

    不过,各有各的好处,可以灵活应用了,针对上面的还是
    $str = "http://lineage2.enet.com.cn/stores/images/pic1063776814491.jpg";
    echo basename($str);
    快捷