$request_uri

This variable is equal to the original request URI as received from the client including the args. It cannot be modified. Look at $uri for the post-rewrite/altered URI. Does not include host name. Example: “/foo/bar.php?arg=baz”

这个变量等于从客户端发送来的原生请求URI,包括参数。它不可以进行修改。

一句话总结:$request_uri 包含请求的文件名和路径及所有参数。客户端请求的 URI 比如:/foo/bar.php?arg=baz,那么 $request_uri 就是:/foo/bar.php?arg=baz

$uri

This variable is the current request URI, without any arguments (see $args for those). This variable will reflect any modifications done so far by internal redirects or the index module. Note this may be different from $request_uri, as $request_uri is what was originally sent by the browser before any such modifications. Does not include the protocol or host name. Example: /foo/bar.html

这个变量指当前的请求URI,不包括任何参数(见$args)。

一句话总结:$uri 只包含请求的文件名和路径,不包含包含“?”或“#”等参数。客户端请求的 URI 比如:/foo/bar.php?arg=baz,通过 $uri 获取的只有:/foo/bar.php