thinkphp6.0(TP6)如何开启调试模式?

2025-10-07 11:37:28

1、安装tp6;首先设置composer镜像源为阿里云源;

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

thinkphp6.0(TP6)如何开启调试模式?

2、composer安装tp6;

composer create-project topthink/think tp6

thinkphp6.0(TP6)如何开启调试模式?

3、将项目根目录下的.example.env文件复制一份,将名称重命名为.tp6.env

thinkphp6.0(TP6)如何开启调试模式?

4、用PHP函数rename重命名,方式比较多。这里直接用默认的index控制器下的index方法下直接写代码进行修改!

//重命名代码实例

<?php

//文件路径

 

$old_file = "D:/phpStudy/PHPTutorial/WWW/tp6/.tp6.env";

 

//新文件路径

 

$new_file = "D:/phpStudy/PHPTutorial/WWW/tp6/.env";

 

//重命名结果,默认为false

 

$flag = false;

if(is_file($old_file)){

 

       $flag = rename($old_file,$new_file);

}

if($flag){

 

       echo "重命名成功!";

 

}else{

 

       echo "重命名失败或者文件不存在!";

}

?>

thinkphp6.0(TP6)如何开启调试模式?

5、.env文件重命名成功!

thinkphp6.0(TP6)如何开启调试模式?

thinkphp6.0(TP6)如何开启调试模式?

6、.env文件中配置开启调试项:APP_DEBUG = true默认是开启的;

 

thinkphp6.0(TP6)如何开启调试模式?

7、写错代码,运行会看到调试信息!

thinkphp6.0(TP6)如何开启调试模式?

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢