創建自變量的類實例我有一些看法,我需要調用static function test()
從中class Plugin_Magazine extends Zend_Controller_Action
Zend框架
。
鑑於我這樣做如下因素:
$class_name = 'Plugin_'.$plugin;
$class_name::test();
結果我有
Catchable fatal error: Argument 1 passed to Zend_Controller_Action::__construct() must be an instance of Zend_Controller_Request_Abstract, none given
但是,如果I W \創建class Plugin_Magazine
Ø延伸一切工作正常。
問題是:我可以以某種方式做我需要的東西或忘記繼承?
第一個問題是:爲什麼要調用一個靜態方法來調用構造函數? – Rijk
問題已通過call_user_func解決(array($ controller_name,'test')) – aloneibreak
將您的答案標記爲已解決,然後編寫答案,不要將其發佈在那裏,因爲它仍然是打開的。 –