【问题标题】:Restler API Explorer 404 : Not Found ../resources.json issueRestler API Explorer 404:未找到 ../resources.json 问题
【发布时间】:2014-01-07 21:43:22
【问题描述】:

我有 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();

但是我收到此处显示的错误消息http://api.odtu.lu/explorer/

请注意,我对共享主机没有任何管理权限,例如编辑 Apache 配置文件和 SSH。而我的PHP版本是http://api.odtu.lu/phpinfo.php

有一个类似的问题,但通过 httpd.conf 文件Can't find resources.json 解决了我没有编辑该文件的权限。

我不知道在哪里可以找到这个 resources.json 文件。

【问题讨论】:

    标签: php restler


    【解决方案1】:

    我遇到了同样的问题,我通过将这一行添加到我的 index.php 来解决:

    $restler->addApiClass('Resources'); //这会产生所需的resources.json

    您可以在此处找到更多信息: Restler always returns 404: Not found

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-10
      • 2013-12-27
      • 1970-01-01
      • 2015-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-25
      相关资源
      最近更新 更多