我正在使用vue.js来构建我的页面。并且网址喜欢这样: http://host/collection.php#!/collection/571372d102334d232de8e680
现在我需要在后端做一些工作,我需要在php中获取集合ID。所以我试图从$ _SERVER获取“#!/ collection / 571372d102334d232de8e680”部分,但部分缺失。< / p>
<?php
var_dump($_SERVER);
?>
输出:
["SCRIPT_FILENAME"]=>string(59) "/data/pk_api/api.pianke.me/api/version4.0/h5/collection.php"
["QUERY_STRING"]=>string(0) ""
["REQUEST_URI"]=> string(29) "/version4.0/h5/collection.php"
如何在'#!'之后获得该部分?
这是我在ngnix中的conf:
server {
listen 80;
server_name tapi.pianke.me;
set $home /data/pk_api/api.pianke.me/api;
access_log /data/pk_api/logs/access.log main;
error_log /data/pk_api/logs/error.log notice;
index index.php index.html index.htm;
root $home;
location / {
index index.html index.htm index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(js|jpg|JPG|jpeg|JPEG|css|bmp|gif|GIF)$
{
access_log off;
}
}