Yii 2.0 registerCssFile cannot register css file correct
In Yii 2.0 Framework's view,cannot use $this->registerCssFile() to register css file. After debug I found it's because not add head() flag in layout file, after add head() into layout, css is register like before
{ registerCssFile }
//views/site/index.php
$this->registerCssFile($this->theme->baseUrl.'/plugins/bootstrap-table/bootstrap-table.min.css', [[View::POS_HEAD]]);
{ add Head flag}
//views/layout/main.php
<header>
...
<?php $this->head(); ?>
</header>
Leave Comment