PHPStorm和ThinkPHP 的使用

PHPStorm和ThinkPHP 的使用,thinkPHP完全开发手册,安装ThinkPHP框架

thinkPHP完全开发手册https://www.kancloud.cn/manual/thinkphp5/118003
一、安装ThinkPHP框架
应用项目:https://github.com/top-think/think
核心框架:https://github.com/top-think/framework

二、PHPStorm打开项目
1、访问项目入口
使用PHPStorm中的命令行工具启动Apache服务、设置端口

$ cd public
$ php -S localhost:8080 router.php

在浏览器中输入 localhost:8080 访问

2、定义路由 打开application中route.php文件 删除文件中原有的配置

use think\Route;

//Route::rule('路由表达式', '路由地址', '请求类型', '路与参数(数组)', '变量规则(数组)');
//Route::get('hello', 'sample/Test/hello');
Route::rule('hello', 'sample/Test/hello');

开启强制路由配置 打开config.php文件,找到’url_route_must’ => false,将false改为true

3、隐藏index.php config.php文件中添加以下代码

'URL_CASE_INSENSITIVE'=>true,
//URL模式
'URL_MODEL'          => '2',

三、ThinkPHP使用手册 https://www.kancloud.cn/manual/thinkphp5/118003

Intoep小程序

微信扫一扫,打开小程序浏览更便捷

转载作品,原作者:CoderSunYu,文章来源:https://juejin.cn/post/6844903523902046216

发表回复

登录后才能评论