这种情况很可能是和服务器配置相关的。
例如本人的情况就是下载了一个新的项目,但是里面的.htaccess文件有问题导致无法获取到get参数,
原来的是这样:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [L,E=PATH_INFO:$1]
</IfModule>
改过之后是:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
然后就可以获取到get参数了。
拿走不谢!