Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.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和log4ppp的自动加载类问题_Php_Api_Rest_Restler_Log4php - Fatal编程技术网

Php Restler和log4ppp的自动加载类问题

Php Restler和log4ppp的自动加载类问题,php,api,rest,restler,log4php,Php,Api,Rest,Restler,Log4php,在使用log4ppp时,我在使用Restler创建API时遇到了一些问题。这似乎是自动装弹机的冲突,但我不确定。作为参考,我将尝试只显示相关的代码部分,所以希望它会有所帮助 在index.php中,我有: require_once("../../config.php"); require_once("../../lib/Luracast/restler.php"); use Luracast\Restler\Restler; $r = new Restler(); $r->addAPICl

在使用log4ppp时,我在使用Restler创建API时遇到了一些问题。这似乎是自动装弹机的冲突,但我不确定。作为参考,我将尝试只显示相关的代码部分,所以希望它会有所帮助

在index.php中,我有:

require_once("../../config.php");
require_once("../../lib/Luracast/restler.php");
use Luracast\Restler\Restler;
$r = new Restler();
$r->addAPIClass('Messages');
$r->addAuthenticationClass('APIAuth');
$r->handle(); //serve the response
其中config.php是我的应用程序的加载和配置。其中包括:

require_once(SYS_PATH.'/lib/log4php/Logger.php');
Logger::configure(SYS_PATH.'/../resources/log4php.xml');
$syslog = Logger::getLogger('System');
到目前为止,我正在构建的消息API仅包含:

class Messages {
    function get($id) {
        return MessageService::getMessage($id);
    }
}
最后,在MessageService中,我们有:

static function getMessage($msgId) {
    global $syslog;
    $syslog->debug("Getting message for id $msgId");
    //extraneous code removed
}
当我这样做并尝试访问messages/get API函数的API时,会出现以下错误:

Fatal error: Class 'LoggerLoggingEvent' not found in /path/to/lib/log4php/Logger.php on line 290
我已经回顾和研究了——这似乎表明不存在任何问题,但我不确定或者一定是做错了什么


希望这一切都是有意义的,并且是清楚的,如果有什么我错过了让我知道。我正在使用Restler 3.0RC3

我们现在正在研究它,并返回给您一个解决方案作为一个类似的问题;您能够解决吗?您应该使用composer自动加载Restler(默认)和Log4HP,并避免使用
require\u一次