Php yii2 urlManager';URL格式'=&燃气轮机';路径';,错误

Php yii2 urlManager';URL格式'=&燃气轮机';路径';,错误,php,yii2,Php,Yii2,我复制了您正在使用的同一个urlManager,我也收到了相同的错误 解决方案 从urlManager配置中删除'urlFormat'=>'path' Unknown Property – yii\base\UnknownPropertyException Setting unknown property: yii\web\UrlManager::urlFormat 1. in /server/www/xmgstudent/vendor/yiisoft/yii2/base/Component.

我复制了您正在使用的同一个urlManager,我也收到了相同的错误

解决方案

从urlManager配置中删除
'urlFormat'=>'path'

Unknown Property – yii\base\UnknownPropertyException

Setting unknown property: yii\web\UrlManager::urlFormat
1. in /server/www/xmgstudent/vendor/yiisoft/yii2/base/Component.php at line 197
'urlManager'=>[
“enablePrettyUrl”=>true,
'enableStrictParsing'=>false,
'showScriptName'=>false,
“规则”=>[
[
'class'=>'yii\rest\UrlRule',
“控制器”=>[“化身”],
“教师时间/索引/”=>“教师时间/索引”,
], 
], 
],

而且它有效

在Yii2中,
UrlManager
类没有
urlFormat
属性。相反,您可以使用并将其设置为
true

这是您的nginx或apache重写错误。
阿帕奇:


ServerName test-yii2.com
DocumentRoot F:/wamp64/www/yii2/frontend/web
选项+索引+包含+跟随符号链接+多视图
允许超越所有
要求所有授权
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则。index.php

欢迎。 你的问题什么?欢迎你的问题是什么?我想要http://******/teacher time/index?a=1 http://***/teacher time/index/a/1你能发布你的urlManager配置代码吗?'urlManager'=>['urlFormat'=>'path','enablePrettyUrl'=>true',enableStrictParsing'=>false',showScriptName'=>false',rules'=>[['class'=>'yii\rest\UrlRule','controller'=>['avatar']],]和],它似乎与问题无关。
'urlManager' => [  
    'enablePrettyUrl' => true, 
    'enableStrictParsing' => false, 
    'showScriptName' => false, 
    'rules' => [ 
        [
            'class' => 'yii\rest\UrlRule',
            'controller' => ['avatar'],
            'teacher-time/index/<id:\d+>'=>'teacher-time/index',
        ], 
    ], 
],
<VirtualHost 127.0.0.1:80>
ServerName test-yii2.com
DocumentRoot F:/wamp64/www/yii2/frontend/web
<Directory  "F:/wamp64/www/yii2/frontend/web">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php
</Directory>