<script> <!-- 编写script标签是为了编辑器识别js代码,可以省略 -->
<?php $this->beginBlock('js_end') ?>   ...js code... <?php $this->endBlock(); ?> </script> <?php $this->registerJs($this->blocks['js_end'],\yii\web\View::POS_END);//将编写的js代码注册到页面底部 ?>

view中引入css/js的方法:

$this->registerJs();
$this->registerJsFile();
$this->registerCss();
$this->registerCssFile();

use yii\web\View;

$view = new View();
$view->registerJs();

posted on 2015-04-29 15:10  浊浊然  阅读(1276)  评论(0编辑  收藏  举报