Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未在YII2中加载Css_Php_Yii2 - Fatal编程技术网

Php 未在YII2中加载Css

Php 未在YII2中加载Css,php,yii2,Php,Yii2,我在YII2中实现了漂亮的url,在实现之前一切都很好,但现在加载了我的应用程序的样式。我能帮忙吗 我的manin.php 'urlManager' => [ 'class' => 'yii\web\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ '<alias:

我在YII2中实现了漂亮的url,在实现之前一切都很好,但现在加载了我的应用程序的样式。我能帮忙吗

我的manin.php

'urlManager' => [
        'class' => 'yii\web\UrlManager',
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
            '<alias:index|login|logout|contact|about|signup|request-password-reset|reset-password>' => 'site/<alias>',
            '<alias:index|create|confirm|confirmation|update|delete>' => 'user/<alias>',
        ],
    ],
'urlManager'=>[
'class'=>'yii\web\UrlManager',
“enablePrettyUrl”=>true,
'showScriptName'=>false,
“规则”=>[
''=>'站点/',
''=>'用户/',
],
],
Request.php

<?php
namespace common\components;
class Request extends \yii\web\Request {
    public $web;
    public $adminUrl;

    public function getBaseUrl(){
        return str_replace($this->web, "", parent::getBaseUrl()) . $this->adminUrl;
    }


/*
    If you don't have this function, the admin site will 404 if you leave off
    the trailing slash.

    E.g.:

    Wouldn't work:
    site.com/admin

    Would work:
    site.com/admin/

    Using this function, both will work.
*/
public function resolvePathInfo(){
    if($this->getUrl() === $this->adminUrl){
        return "";
        }else{
            return parent::resolvePathInfo();
        }
    }
}

以确保应在配置文件中添加以下行..`
'request'=>[/!!!在以下位置插入一个密钥(如果为空)-这是cookie验证'class'=>'app\components\request','web'=>'/web','cookieValidationKey'=>'jdqkjamguitakcsjy6yvlqdm9jf7wghx',][/code>
RewriteCond%{request\u FILENAME}所必需的-f RewriteCond%{REQUEST_FILENAME}-重写了规则^.*$frontend/web/index.php
,以确保应在配置文件中添加以下行..`
'request'=>[/!!!在以下位置插入一个密钥(如果为空)-这是cookie验证'class'=>'app\components\request','web'=>'/web','cookieValidationKey'=>'jdqkjamguitakcsjy6yvlqdm9jf7wghx',][/code>
RewriteCond%{request\u FILENAME}所必需的-f RewriteCond%{REQUEST_FILENAME}-重写规则^.*$frontend/web/index.php
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
</IfModule>

    <IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]
RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css)/
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^.*$ backend/web/index.php [L]
RewriteCond %{REQUEST_URI} ^/(assets|css)
RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css)/
RewriteCond %{REQUEST_URI} !index.php


 RewriteCond %{REQUEST_FILENAME} !-f [OR]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ frontend/web/index.php
</IfModule>