我有两个类:Action和MyAction。后者声明为:我所需要的就是Action类中的方法(只在其中,因为会有很多继承的类,我不想在所有类中都实现这个方法),它将从静态调用中返回类名。这就是我要说的: function n(){/* something */}当我叫它的时候:但父类中的每个声明只能访问父类__CLASS__变量,该变量
最好的方法$class::getInstance();只在PHP5.3中可用,而我发现的另一种方法call_user_func(array($class, 'getInstance'));会导致最大执行时间被破坏loadLibrary($lib) // Filter $lib, and load the library class file...
// Following only works in PHPcall_user_func(array($lib, 'getInst
当方法在父类中时,我如何返回被调用的类的实例。abstract class A public static function foo() $instance = new A(); // I want this to return a new instance of child class. return $instance;}
{
基本上,如果类- CMIIW中不存在方法,则将调用魔术方法__call()。class Controller public function __call($method, $args) //echo error { }和AuthController,它像这样扩展了基本Controller
class AuthController extends Cont
class A static function get_name_derived_class() //This function must return the name of the real class {{
我希望在基类中有一个静态的方法,它返回真实(派生)类的名称,而不需要在其中插入特定的方法。有可能吗?谢谢
我有以下课程: static $static_var = 'base_static'; // HERE, I want to get the caller extended class. // HERE, I want to get the caller extended static variable.
echo sta