Home >Backend Development >PHP Tutorial >call_user_func_array cannot call the method of the parent class
asklogic extends baselogic
asklogic has a property static::$model
which is an askmodel object
askmodel extends basemodel
but static::$model cannot call methods in basemodel
Also. . Use this method to call in __call
$data = call_user_func_array([static::$model, $method], $arguments);
Solving
Language php
Framework tp
asklogic extends baselogic
asklogic has a property static::$model
which is an askmodel object
askmodel extends basemodel
but static::$model cannot call methods in basemodel
Also. . Use this method to call in __call
$data = call_user_func_array([static::$model, $method], $arguments);
Solving
Language php
Framework tp
Thank you for the invitation
I haven’t used TP for a long time. I am not familiar with TP. I invited a friend of mine @白junyao for you. He is very familiar with TP. I hope he can solve your problem
public static $model
Is it your own definition? Of course $model cannot be called if it is not assigned a value. It is usually written like this.
<code>class A { protected static $model; public static function getModelInstance() { if (empty(static::$model)) static::$model = new YourClass(); return static::$model; } } //call echo A::getModelInstance()->method();</code>