【发布时间】: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 并且运行良好