PHP :: Call to a member function assign() on null

报这个错翻译:在null上调用成员函数赋值()

PHP :: Call to a member function assign() on null

其实是构造函数写法的问题

PHP自带的构造函数是 __construct() 但是子类不会自动继承父类的构造函数。而ThinkPHP 自己封装了一个构造函数 _initialize()是可以自动继承父类的构造函数

解决方法

1、如果使用TP框架可以用 _initialize()函数

PHP :: Call to a member function assign() on null

2、TP用户也可以两个一起使用的

PHP :: Call to a member function assign() on null

3、最后一种 也是本人最喜欢用的?

PHP :: Call to a member function assign() on null

 

相关文章: