好吧,我在AppAsset中声明了我所有的CSS和
JavaScript内容,但我不能让它在前端视图中显示css和js链接.这是我的文件:
应用程序/资产/ AppAsset.PHP:
<?PHP namespace app\assets; use yii\web\AssetBundle; class AppAsset extends AssetBundle { public $basePath = '@webroot'; public $baseUrl = '@web'; public $css = [ 'assets/css/bootstrap.min.css','assets/plugins/weather-icon/css/weather-icons.min.css',... ]; public $js = [ ]; public $depends = [ 'yii\web\YiiAsset','yii\bootstrap\BootstrapAsset',]; }
这是我的布局(app / modules / admin / layouts / admin.PHP):
<?PHP use app\assets\AppAsset; AppAsset::register($this); ?> <?PHP $this->beginPage() ?> <!DOCTYPE html> <html lang="en"> <head> <?PHP $this->head() ?> <?= $this->render('partials/head') ?> </head> <body class="tooltips"> <?= $this->render('partials/colour_panel') ?> <div class="wrapper"> <?= $this->render('partials/top_navbar') ?> <?= $this->render('partials/left_sidebar') ?> <?= $this->render('partials/right_sidebar') ?> <div class="page-content"> <div class="container-fluid"> <?= $content ?> <?= $this->render('partials/footer') ?> </div> </div> </div> <?= $this->render('partials/scripts') ?> </body> </html> <?PHP $this->endPage() ?>
提前致谢!
我有同样的问题.在我的情况下,布局没有<?PHP $this-> beginBody()?>和<?PHP $this-> endBody()?>里面的部分< body>< / body>标签.
它应该是这样的:
<body> <?PHP $this->beginBody() ?> <!--content--> <?PHP $this->endBody() ?> </body>
希望它对某人有帮助
原文地址:https://www.jb51.cc/php/135829.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。