js和css的引入
use yii\helpers\Html;
1.全局引入,所有的view生效
/assets/AppAsset.php
public $css = ['css/site.css','css/style.css',];public $js = ['js/upload.js',];
2.局部引入,在该view中生效
(1)
<?=Html::jsFile('@web/***/js/***.js')?>//这里***代表你的目录名或者文件名<?=Html::cssFile('@web/***/css/***.css')?>//***同上
(2)
<?php $this->registerCssFile('@web/***/js/***.js');?><?php $this->registerJsFile('@web/***/js/***.js');?>