【问题标题】:Restler 3 - Setup configurationRestler 3 - 设置配置
【发布时间】:2013-02-21 21:36:52
【问题描述】:

我正在使用具有 PHP 5.3.1 的 XAMPP,在 htdocs 文件夹中具有 restler 结构

在我的 htdocs 文件夹中,我有 index.php

<?php
require_once 'vendor/restler.php';
use Luracast\Restler\Restler;

$r = new Restler();
$r->addAPIClass('Say'); // repeat for more
$r->handle(); //serve the response

然后说.php

<?php
class Say {

    /*
    * @url GET /
    */
    function hello($to='world') {
        return "Hello $to!";
    }

    function hi($to) {
        return  "Hi $to!";
    }
}

在浏览器中,我放了

localhost/index.php/说

localhost/index.php/Say/hello

它给了我以下信息

致命错误:在第 143 行的 /Applications/XAMPP/xamppfiles/htdocs/Luracast/Restler/AutoLoader.php 中调用未定义函数 Luracast\Restler\stream_resolve_include_path()

我做错了什么?

【问题讨论】:

  • stream_resolve_include_path 仅在 php 5.3.2 上可用,但restler 应该在 5.3 及更高版本上工作。我们会解决这个问题。同时你可以尝试升级PHP,看看它是否有效?你可以关注github中的autoloader conversation
  • 成功了。更改为支持 PHP 5.4 的 AMPSS 并且运行良好

标签: php xampp restler


【解决方案1】:

问题出在 PHP 版本上。从 XAMPP 更改为支持 PHP 5.4 的 AMPSS 并且现在可以使用

【讨论】:

    【解决方案2】:

    不知道它是否有帮助,但你有没有试过 用小写写Say?

    localhost/index.php/say

    你的代码在我看来不错...

    铜 英格

    【讨论】:

      【解决方案3】:

      Restler 3 是 PHP 5.3,函数 stream_resolve_include_path 将在 5.3.2 及更高版本中定义。

      【讨论】:

        猜你喜欢
        • 2016-08-15
        • 1970-01-01
        • 2023-03-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多