php框架之thinkphp

时间:2023-01-18 21:28:48

  日常开发中经常使用thinkphp5进行开发工作,总结一些使用中遇到的问题和使用的东西

1. web内置服务

V5.1.5+版本开始,增加了启动内置服务器的指令,方便测试

>php think run

ThinkPHP Development server is started On <http://127.0.0.1:8000/>
You can exit with `CTRL-C`
Document root is: D:\WWW\tp5/public

  打开地址即可正常访问

问题:我使用的时候,无法正常使用,报出异常之后退出

解决:指定其他端口进行设置之后成功,例如:

E:\xampp\php7.3.3\php think run --host 127.0.0.1 --port 

常见错误:

  1)session_start(): Failed to initialize storage module: user

  使用的redis作为缓存, 需要确定配置文件是否配置正确