一,單個view中:
寫到方法最後fetch操作之前:
//列出所有新房
public function list() {
...
$config = $this->view->config;
$config['jsname'] = '';
$this->assign('config', $config);
return $this->view->fetch('list');
}
二,整個php類中:
寫到類的初始化方法中即可
public function _initialize()
{
parent::_initialize();
//$this->model = new \app\admin\model\testdir\Test;
$config = $this->view->config;
$config['jsname'] = '';
$this->view->config = $config;
//$this->assign('config', $config);
}