且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP从URL路径获取参数

更新时间:2021-09-03 23:19:42

explode('/', getenv('REQUEST_URI'));

如果您的环境恰好在上述值中包含查询字符串部分,请采用以下整洁的解决方法:

If your environment happens to include the query string part in the above value, here's a neat workaround:

explode('/', strtok(getenv('REQUEST_URI'), '?'));