1.
http://abc/innd/ffdss/Jack
2.
http://abc/innd/ffdss/dfdf/ssss/Peter
3.
http://abc/ffdss/Sam
麻烦大神用一句正则匹配末尾把这三个网址最后的Jack、Peter和Sam匹配出来
好久不用正则忘记了- -
//可以不需要正则$url = 'http://abc/innd/ffdss/Jack';echo substr($url, strrpos($url, '/')+1);
//可以不需要正则$url = 'http://abc/innd/ffdss/Jack';echo substr($url, strrpos($url, '/')+1);
$s = 'http://abc/innd/ffdss/Jack';preg_match('#/([^/]+)$#', $s, $m);echo $m[1];