yii2.0中如何引入js/css文件呢

yii2.0中如何引入js/css文件呢


慕尼黑8549860
浏览 640回答 2
2回答

largeQ

公共js在布局文件引入,也就是main.php单独view的js以及公共js都是使用$this->registerJs()$this->registerJsFile()$this->registerCss()等方法引入如果不行(上述方法一般可行,我在yii2就是这么用的),你可以使用use View;(前面的命名空间忘记了,你找一下,里面有上所述的方法)然后实例化$view = new View(); 然后$this->registerJs()等等

慕少森

<?php $this->beginBody() ?><?php echo $content;?><?php $this->endBody() ?><?php $this->head() ?><?php $this->beginPage() ?><?php$this->endPage();?>加上就有了
打开App,查看更多内容
随时随地看视频慕课网APP