Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何检查是否$_SERVER['REQUEST_URI']为空(即用户访问过),但如果URL 中domain.com/有一个异常( )$_GETdomain.com/?a=1
$_SERVER['REQUEST_URI']
domain.com/
$_GET
domain.com/?a=1
您可以使用parse_url来实现这一点
parse_url
if(parse_url($_SERVER['REQUEST_URI'],PHP_URL_QUERY) !== null) { // It Contains get var_dump($_SERVER['REQUEST_URI']); }