E://AppServ/www/lyko2/music/大笑江湖-小沈阳.mp3。
要怎么切能得到   music/大笑江湖-小沈阳.mp3

解决方案 »

  1.   

    mb_strcut($_GET["Url"], 0, 7, "UTF-8");只能得到前面的,后面的呗切了,我就是要后面的额
      

  2.   

    用strpos找到倒数第二个“/”,然后截断即可。
      

  3.   

    O了,mb_strcut($_GET["Url"], 21, 100, "UTF-8")E://AppServ/www/lyko2/  从21开始,由于不清楚那URL多长,我截了100,呵呵 。明天结贴啊,多散点分
      

  4.   

    $a = "E://AppServ/www/lyko2/music/大笑江湖-小沈阳.mp3";
    echo mb_strcut($a, 22, 26, "UTF-8");
    自己尝试着改啊
      

  5.   

    正则更灵活:
    $a = "E://AppServ/www/lyko2/music/大笑江湖-小沈阳.mp3";
    preg_match("/\/([^\/]+\/[^\/]+)$/",$a,$match);print_r($match);
      

  6.   

    对了,也可以用explode对/进行拆分,然后最后两个组合即可。
      

  7.   

    $a = "E://AppServ/www/lyko2/music/大笑江湖-小沈阳.mp3";
    preg_match("/\/([^\/]+\/[^\/]+)$/",$a,$match);print_r($match);
      

  8.   

    多的是。
    //方法一:
    $str = 'E://AppServ/www/lyko2/music/大笑江湖-小沈阳.mp3';
    $arr = explode('/',$str);
    echo $arr[count($arr)-2].'/'.end($arr);
    //方法二:
    echo implode('/',array_slice(explode('/',$str),-2,2));//还有可以用正则提取,方法多的是。
      

  9.   


    如果前面路径都是英文,只要用substr即可substr($_GET['Url'],21)
      

  10.   

    $a = "E://AppServ/www/lyko2/music/大笑江湖-小沈阳.mp3";
    preg_match("/\/([^\/]+\/[^\/]+)$/",$a,$match);print_r($match);
      

  11.   

    习惯性用 pathinfo 函数,楼主试试,看这个给力不?