简体   繁体   English

Restler API Explorer 404:找不到../resources.json问题

[英]Restler API Explorer 404 : Not Found ../resources.json issue

I have API http://api.odtu.lu/v1/index.php/users/3 and the explorer http://api.odtu.lu/explorer/ and my index.php file is as follows 我有API http://api.odtu.lu/v1/index.php/users/3和资源管理器http://api.odtu.lu/explorer/ ,我的index.php文件如下

require_once '../vendor/restler.php';
ORM::configure('mysql:host=localhost;dbname=thedatabasename');
ORM::configure('username', 'ilhan');
ORM::configure('password', 'password123');
ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
use Luracast\Restler\Restler;
$r = new Restler();
$r->addAPIClass('Luracast\\Restler\\Resources');
$r->addAPIClass('Users');
$r->handle();

However I get the error message shown here http://api.odtu.lu/explorer/ 但是我在这里显示了错误消息http://api.odtu.lu/explorer/

Note that I don't have any administrative rights on the shared hosting, like editing Apache configuration files and SSH. 请注意,我对共享主机没有任何管理权限,例如编辑Apache配置文件和SSH。 And my PHP version is http://api.odtu.lu/phpinfo.php 我的PHP版本是http://api.odtu.lu/phpinfo.php

There is a similar issue but resolves it by httpd.conf file Can't find resources.json I don't have permissions to edit that file. 有一个类似的问题,但是可以通过httpd.conf文件解决。 找不到资源 。json,我没有编辑该文件的权限。

I have no idea where to find this resources.json file. 我不知道在哪里可以找到这个resources.json文件。

I had the same problem, and i solved by adding this line to my index.php: 我有同样的问题,我通过将这一行添加到我的index.php中来解决了:

$restler->addApiClass('Resources'); $ restler-> addApiClass( '资源'); //this produces the needed resources.json //这会产生所需的resources.json

You can find more info here: Restler always returns 404: Not found 您可以在此处找到更多信息: Restler总是返回404:未找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM