我使用Tonic Framework(https://github.com/peej/tonic)作为我的rest-webservice。
的getUser:
/**
* This class defines an example resource that is wired into the URI /example (/{id})?
* @namespace Test
* @uri /nff/user/{uid}
*/
require_once('dbmodel.php');
require_once('error.php');
require_once('user.php');
class GetUserController extends Resource {
function get($request,$uid) {
.....
}
我的问题是我无法访问$_GET
参数。
我认为问题可能出在.htaccess
:
<IfModule mod_rewrite.c>
RewriteEngine On
#exclude
RewriteRule ^img/ - [L]
RewriteRule ^verify.php - [L]
RewriteCond %{REQUEST_URI} !dispatch\.php$
#RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* dispatch.php [L,QSA]
</IfModule>
请帮忙
答案 0 :(得分:1)
您的上一次重写规则会将所有内容重写为dispatch.php而不附加GET参数。你必须添加一个带参数的规则并重写到dispatch.php?$ 1
RewriteRule ^[^\?]*\?(.*)$ dispatch.php?$1 [L,QSA]
RewriteRule .* dispatch.php [L,QSA]