ThinkPHP调用error和success方法时报错

来源:互联网 发布:mac怎么查看群相册 编辑:程序博客网 时间:2024/06/03 05:06

最近使用ThinkPHP时发现不能调用$this->error()方法,总是提示错误:

syntax error, unexpected ')', expecting T_VARIABLE or '$'

并且错误位置在缓存文件中,特别纠结,这个bug调好几天了,知道查看log文件才知道是内部解析出的错误.

错误在ThinkPHP/Lib/Template/TagLib.class.php  的parseXmlAttr函数中:

 $xml    =   (array)($xml->tag->attributes());

 $array  =   array_change_key_case($xml['@attributes']);

替换为:

$array = array();

foreach($xml->tag->attributes() as $a=>$b) {

$array[$a] = $b;

}

问题解决。

由此发出感想:在出现错误时不能完全看它提示的所理解,要在日志文件Log中找到错误位置,

日志文件必不可少,对于我们查找错误和解决问题帮助非常大。


0 0
原创粉丝点击