PHPCMS系统内定义了一个很段的函数:go(),因为太短,这个go函数很容易和其他代码内的函数重名,我遇到的是swoole内也有go函数,所以当PHPCMS遇到swoole,就会出现如下提示:
Cannot redeclare go() in xxx/phpcms/libs/functions/global.func.php on line 1476整个问题目前也没有很好的解决方法,如果必须使用swoole的话,就只能修改PHPCMS的代码,把go()改成其他的函数名。反正现在PHPCMS项目已经是快要死透的状态,八百年不会有什么更新了。
共有7个文件需要修改。
一:phpcms/libs/functions/global.func.php
找到:
function go($catid,$id, $allurl = 0)改为:
function pc_go($catid,$id, $allurl = 0)二:phpcms/modules/admin/position.php
找到:
$r['url'] = go($_v['catid'], $_v['id']);改为:
$r['url'] = pc_go($_v['catid'], $_v['id']);三:phpcms/modules/content/classes/comment_api.class.php
找到:
'url'=>go($catid, $contentid, 1)改为:
'url'=>pc_go($catid, $contentid, 1)四:phpcms/modules/content/classes/content_tag.class.php
找到:
$array[$key]['url'] = go($info['catid'],$info['id']);改为:
$array[$key]['url'] = pc_go($info['catid'],$info['id']);五:phpcms/modules/member/content.php
找到:
go($_v['catid'],$_v['id'])改为:
pc_go($_v['catid'],$_v['id'])六:phpcms/modules/special/classes/special_tag.class.php
找到:
$r['url'] = go($content_arr['1'], $content_arr['0']);改为:
$r['url'] = pc_go($content_arr['1'], $content_arr['0']);七:phpcms/modules/special/templates/content_list.tpl.php
找到:
$r['url'] = go($content_arr['1'], $content_arr['0']);改为:
$r['url'] = pc_go($content_arr['1'], $content_arr['0']);这样修改后,PHPCMS就不会因为和SWOOLE重复定义go()发生错误了。