如何在PHP中从url中提取关键字?
示例:
http://example.com/item/search/shoes/
http://example.com/item/search/shoes/page/3/
以上网址的提取关键字应为鞋子
任何帮助都非常感谢。
fgwapo
答案 0 :(得分:1)
答案 1 :(得分:-1)
$keywords = explode("/", $HTTP_SERVER_VARS['REQUEST_URI']);
//$keywords[1] = example.com
//$keywords[2] = item
//$keywords[3] = search
//$keywords[4] = shoes
//$keywords[5] = page
//$keywords[6] = 3