时间:2021-07-01 10:21:17 帮助过:3人阅读
'urlManager' => [
'enablePrettyUrl' => true, //美化url==ture
'enableStrictParsing' => false, //不启用严格解析
'showScriptName' => false, //隐藏index.php
'rules' => [
'/'=>'/',
],
],
然后配置了nginx的rewrite
listen 80;
server_name localhost;
location / {
root D:/Github/Server/advanced;
index index.php index.html index.htm;
#开启rewirte
if (!-e $request_filename){
rewrite ^/(.*) /index.php?r=$1 last;
}
真心求解,
写了一个接口,使用路径为localhost/api/web/index.php?r=user/test
actiontest的代码就是echo '123';
根据网上的教程,配置了urlmanager,代码如下
'urlManager' => [
'enablePrettyUrl' => true, //美化url==ture
'enableStrictParsing' => false, //不启用严格解析
'showScriptName' => false, //隐藏index.php
'rules' => [
'/'=>'/',
],
],
然后配置了nginx的rewrite
listen 80;
server_name localhost;
location / {
root D:/Github/Server/advanced;
index index.php index.html index.htm;
#开启rewirte
if (!-e $request_filename){
rewrite ^/(.*) /index.php?r=$1 last;
}
真心求解,