0
如何在組件存在的情況下首先添加包含檢查的組件。 我用這個介紹CakePHP 2.2.3在cakephp中添加組件2.3.4
public function __construct($request = null, $response = null) {
parent::__construct($request, $response);
$this->_setupApplicationComponents();
}
protected function _setupApplicationComponents() {
if (App::import('Component', 'Search.Prg')) {
$this->components[] = 'Search.Prg';
}
}
它不是在CakePHP的2.3.4工作。
任何人都可以提供幫助。
謝謝
其實組件不是懶加載,只有模型(至少在2.6.3)。放置在$ components中的每個組件都被初始化。 – 2015-03-17 16:18:44