假设我的 URL 如下所示:http://www.example.com/category/product/htc/desire ,我使用 $_SERVER['REQUEST_URI']
获取/category/product/htc/desire,如何将这个“/category/product/htc/desire”转换为数组,如下所示:
array
(
[0] => category
[1] => product
....
)
谢谢
最佳答案
$array = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
关于PHP - 数组的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5359439/