Like:
"http://www.blog-name.com/search/taio cruz" ---------------------------------------------^ "Sorry, no posts were found with the tag taio cruz"
The Problem:
If the user enters http://www.blog-name.com/search/taio cr开发者_开发技巧uz
, the browser will look for a folder named "taio cruz", won't it ?
How can I get the value "Taio Cruz"?
echo basename("http://www.blog-name.com/search/taio cruz"); //taio cruz
$url = 'http://www.blog-name.com/search/taio cruz';
$val = end(explode('/', $url));
// $val is now 'taio cruz'
$url = 'http://www.blog-name.com/search/taio cruz';
$last = substr($url, strrpos($url, '/') + 1);
//$last is now "taio cruz"
精彩评论