在控制器中执行此操作的一些方法:
$viewmodel = new ViewModel();
$viewmodel->setVariable('myvar', $myvar);
return $viewmodel;
Run Code Online (Sandbox Code Playgroud)
$this->layout()->myvar = $myvar;
Run Code Online (Sandbox Code Playgroud)
<?php echo $this->myvar; ?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3743 次 |
| 最近记录: |