在VIEW引入CSS、JS文件

外联 CSS:

 <?= Html::cssFile('@web/css/ie5.css', ['condition' => 'IE 5']) ?>

generates

<!--[if IE 5]>
    <link href="http://example.com/css/ie5.css" />
<![endif]-->

外联JS

<?= Html::jsFile('@web/js/main.js') ?>

 

generates

<script type="text/javascript" src="/basic/web/js/main.js"></script>

内联CSS

<?= Html::style('.danger { color: #f00; }') ?>

 

Gives you

<style>.danger { color: #f00; }</style>

内联JS
<?= Html::script('alert("Hello!");', ['defer' => true]);

Gives you

<script defer>alert("Hello!");</script>

 

posted on 2015-12-02 16:57  会学习的猪  阅读(654)  评论(0编辑  收藏  举报

导航