ReflectionClass getDocComment 返回false

/*
* A test class
*
* @param  foo bar
* @return baz
*/
class TestClass { }
error_reporting(E_ALL);
try {
    $rc = new ReflectionClass('TestClass');
    var_dump($rc->getDocComment());
catch (Exception $logicDuh) {
    print_r($logicDuh);
}

上述代码在有些服务器上会返回false

因为很多服务器都装了

eAccelerator
默认优化的时候删除了PHP的文档块并缓存代码编译结果,所有调用反射接口的时候返回false

编译eaccelerator的时候增加

--with-eaccelerator-doc-comment-inclusion
详细:
https://eaccelerator.net/ticket/229 (已墙)

 


 

posted @ 2012-08-21 09:30  liushan  阅读(669)  评论(0编辑  收藏  举报