Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Restler中的REST服务在部署到测试服务器后找不到任何路由_Php_Restler - Fatal编程技术网

Php Restler中的REST服务在部署到测试服务器后找不到任何路由

Php Restler中的REST服务在部署到测试服务器后找不到任何路由,php,restler,Php,Restler,Restler 3.0.0rc6 我在本地开发环境中的Restler中设置了一个简单的REST服务。当我移动到测试服务器时,Restler找不到任何路由 我通过远程主机将项目与git同步。我刚刚将最新的本地更改拉入测试服务器,因此文件夹设置应该可以 错误出现在方法find的Routes.php第362行,该方法试图找到与请求的url匹配的api方法。此文件中的说明: $p = Util::nestedValue(static::$routes, "v$version"); 返回$p=NULL。

Restler 3.0.0rc6

我在本地开发环境中的Restler中设置了一个简单的REST服务。当我移动到测试服务器时,Restler找不到任何路由

我通过远程主机将项目与git同步。我刚刚将最新的本地更改拉入测试服务器,因此文件夹设置应该可以

错误出现在方法find的Routes.php第362行,该方法试图找到与请求的url匹配的api方法。此文件中的说明:

$p = Util::nestedValue(static::$routes, "v$version");
返回$p=NULL。调用中的参数值为:

static::$routes is an empty array - array(). 
$version is int(1)
在这段代码之后,如果$p=NULL,则条件触发异常

我尝试了mininum Hello world示例,但总是遇到同样的问题

由于该应用程序在我的本地服务器上运行良好,我可以想到测试服务器中的某些配置会把一切都搞乱,但无法跟踪到底是什么。因为我不知道从哪里开始,我只是包括一些信息,以防它可能是有用的

我包括我的文件夹配置:

html/api/ -> index.php and custom class files
html/api/data-base -> database acces files 
html/api/vendor -> Restler
我的index.php文件

<?php
require_once 'vendor/restler.php';
require_once('data-base/data-base-pdo.php');
use Luracast\Restler\Restler;
$r = new Restler();
$r->addAPIClass('Individuals');
$r->addAPIClass('Injuries');
$r->addAPIClass('Measurements');
$r->addAPIClass('Sessions');
$r->addAPIClass('Reports');
$r->handle();
我的一个类文件:

<?php
use Luracast\Restler\RestException;
class Individuals
{
    public $db;
    public function __construct() {
        $this->db = DataBase::getInstance();
    }

    public function index() {
        return $this->db->individualsSelect();
    }

    public function get($id) {
        try {
            return $this->db->individualsSelectOne($id);
        } catch(mysqli_exception $e) {
            throw new RestException(500, $e->getMessage(), array(), $e);
        } catch(InvalidArgumentException $e) {
            throw new RestException(400, $e->getMessage(), array(), $e);
        }
    }

    public function put($id, $request_data) {
        try {
            return $this->db->individualsUpdate($id, $request_data);
        } catch(mysqli_exception $e) {
            throw new RestException(500, $e->getMessage(), array(), $e);
        } catch(InvalidArgumentException $e) {
            throw new RestException(400, $e->getMessage(), array(), $e);
        }       
    }

    /**
     * @url GET {individuals_id}/injuries
     */
    public function injuries($individuals_id) {
        try {
            return $this->db->injuriesSelectByIndividual($individuals_id);
        } catch(mysqli_exception $e) {
            throw new RestException(500, $e->getMessage(), array(), $e);
        } catch(InvalidArgumentException $e) {
            throw new RestException(400, $e->getMessage(), array(), $e);
        }
    }

    /**
     * @url GET {individuals_id}/measurements
     */
    public function measurements($individuals_id) {
        try {
            return $this->db->measurementsSelectByIndividual($individuals_id);
        } catch(mysqli_exception $e) {
            throw new RestException(500, $e->getMessage(), array(), $e);
        } catch(InvalidArgumentException $e) {
            throw new RestException(400, $e->getMessage(), array(), $e);
        }
    }

    /**
     * @url GET {individuals_id}/sessions
     */
    public function sessions($individuals_id) {
        try {
            return $this->db->sessionsSelectByIndividual($individuals_id);
        } catch(mysqli_exception $e) {
            throw new RestException(500, $e->getMessage(), array(), $e);
        } catch(InvalidArgumentException $e) {
            throw new RestException(400, $e->getMessage(), array(), $e);
        }
    }
}

问题在于文件名和类名的大小写。我所有的类都以类似大写的personals开头,但文件都是类似于personals.php的小写。我的开发环境不区分大小写,所以restler可以为我的类找到文件,但一旦我部署到测试服务器上,一切都被破坏了