Yii2 AppAsset是';不包括

Yii2 AppAsset是';不包括,yii2,yii2-advanced-app,Yii2,Yii2 Advanced App,我从git复制了一个存储库,前端似乎还可以,但在后端,我对AppAsset有问题 AppAsset文件: <?php namespace backend\assets; use yii\web\AssetBundle; /** * Main backend application asset bundle. */ class AppAsset extends AssetBundle { public $basePath = '@webroot'; public $

我从git复制了一个存储库,前端似乎还可以,但在后端,我对AppAsset有问题

AppAsset文件:

<?php

namespace backend\assets;

use yii\web\AssetBundle;

/**
 * Main backend application asset bundle.
 */
class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        'css/site.css',
    ];
    public $js = [
    ];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\bootstrap\BootstrapAsset',
    ];
}
我觉得问题可能出在AppAssets配置上。而且我对yii和

不起作用:

工作原理:

您是否尝试检查生成的html代码中是否有用于包含css文件的标记以及它们生成时使用的url?不久后我解决了这个问题,原因是baseurl在后端->配置->主->组件中设置为admin,一旦删除它,工作正常
<?php

/* @var $this \yii\web\View */
/* @var $content string */

use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use common\widgets\Alert;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php $this->registerCsrfMetaTags() ?>
    <?php $this->registerCssFile("@backend/web/css/site.css") ?>
    <?php /*$this->registerCss("body { background: #f00; }") */?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<h1>Hello world</h1>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
h1{
    background: red;
}
body{
    background: red;
}