我被困在这里,在 wamp 中我运行一切并且工作正常,但是,当我尝试在 centos 盒子中安装我的 api 时,我总是收到“未找到”错误。
我不知道还能做什么!
即使 say/hello 的例子也失败了......
是否有处理 Restler 的 apache 要求规范?
有什么想法吗?有点紧急
say.php:
<?php
class Say {
function hello($to='world') {
return "Hello $to!";
}
}
索引.php
<?php
require_once 'restler/restler.php';
require_once 'say.php';
$r = new Restler();
$r->addAPIClass('Say');
$r->setSupportedFormats('jsonpformat', 'jsonformat', 'xmlformat', 'yamlformat');
$r->handle();
.htaccess
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
php_flag display_errors On
</IfModule>
error:
未找到在此服务器上找不到请求的 URL /mylocation/say/hello。
这基本上就是我的全部代码,如果你们认为 jsonformat 可能以我的方式休眠,我可以将该代码粘贴到此处。
当我像这样输入网址时:http://myhost/mylocation/
我收到一个 json 错误:
{
"error": {
"code": 404,
"message": "Not Found"
}
}
如果我输入http://myhost/mylocation/say/hello
然后我得到未找到错误,就像 .htaccess 不起作用一样。
[EDIT]
如果我像这样将“index.php”添加到网址中,它似乎可以工作:http://myhost/mylocation/index.php/say/hello
,但我不能就这样离开……
我从以下地方得到这个:如果 URL 中不包含 index.php,Restler 将返回 404 状态代码