您无需配置任何内容。只要确保请求映射到您的PHP文件并使用带有路径信息的请求即可。例如,如果您在根目录中
handler.php具有以此内容命名的文件:
<?phpvar_dump($_SERVER['REQUEST_METHOD']);var_dump($_SERVER['REQUEST_URI']);var_dump($_SERVER['PATH_INFO']);if (($stream = fopen('php://input', "r")) !== FALSE) var_dump(stream_get_contents($stream));以下HTTP请求将起作用:
Established connection with 127.0.0.1 on port 81PUT /handler.php/bla/foo HTTP/1.1Host: localhost:81Content-length: 5 booHTTP/1.1 200 OKDate: Sat, 29 May 2010 16:00:20 GMTServer: Apache/2.2.13 (Win32) PHP/5.3.0X-Powered-By: PHP/5.3.0Content-Length: 89Content-Type: text/html string(3) "PUT"string(20) "/handler.php/bla/foo"string(8) "/bla/foo"string(5) "boo"Connection closed remotely.
您可以使用MultiViews隐藏“php”扩展名,也可以使用mod_rewrite使URL完全符合逻辑。



