开胃
如果你写http://本地网址/index/index/index出现错误
修改public下面的.htaccess下的
RewriteRule ^(.*)$ index.php/
1
[
Q
S
A
,
P
T
,
L
]
变
成
R
e
w
r
i
t
e
R
u
l
e
(
.
∗
)
1 [QSA,PT,L] 变成 RewriteRule ^(.*)
1[QSA,PT,L]变成RewriteRule(.∗) index.php [L,E=PATH_INFO:$1]
就可以了
1:在app下的index模块的index方法打印出
public function index(){
dump($_ENV);
}
如果返回的数据为空修改参考
在php.ini中 variables_order = ‘EGPCS‘;
https://blog.csdn.net/lijincheng77266/article/details/82757679?locationNum=4&fps=1
2:配置环境
在config目录下 新建这四个文件夹
1:config文件中内容
<?php
use think\Env; //引入env这个类
return [
'app_status' => Env::get('status','dev')
]
?>
1:dev,test,prod文件中内容
<?php
use think\Env; //引入env这个类
<?php
return [
'app_now_status' => '文件名称'
]
?>
在.env中添加
<?php
status=prod
?>
根据status中的值配置环境