好吧,我在AppAsset中声明了我所有的CSS和
JavaScript内容,但我不能让它在前端视图中显示css和js链接.这是我的文件:
原文链接:https://www.f2er.com/php/135829.html应用程序/资产/ 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() ?>
提前致谢!