我迁移了我的云服务器,在安装了所有lamp组件并克隆了我的存储库之后,我的php就是不识别“父”常量。
我的日志上说。
on 08 21:29:28 2015客户机186.223.169.223 PHP通知:在/home/dev/ xxx /Funcionario.php第11行中使用未定义的常量父程序-假定的“父”
在代码中我有
class Funcionario extends Model {
protected function init() {
$this -> db = DataBase::getInstance('000001');
call_user_func_array(array( parent, 'init'), func_get_args() );
}
}大胸。PHP-5.4
谢谢。
发布于 2015-07-09 01:29:50
使用未定义的常量父-假定的“父”
这是因为没有在parent后面跟着作用域运算符::被认为是一个常量;如果您将其设置为字符串,它可以正常工作:
call_user_func_array(array('parent', 'init'), func_get_args());如果没有它,它也可以正常工作,您现在看到这个通知的唯一原因是因为error_reporting级别不同。
https://stackoverflow.com/questions/31306273
复制相似问题