From a1d3a2d2e354e76294929863bddc3b1802e23cdc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 8 Mar 2017 15:28:46 +0800 Subject: [PATCH 001/186] =?UTF-8?q?5.1=E6=96=87=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cache.php | 25 ++++++ {application => config}/config.php | 130 ++------------------------- config/cookie.php | 30 +++++++ {application => config}/database.php | 0 config/log.php | 22 +++++ config/session.php | 26 ++++++ config/template.php | 33 +++++++ config/trace.php | 18 ++++ {application => route}/route.php | 16 ++-- 9 files changed, 170 insertions(+), 130 deletions(-) create mode 100644 config/cache.php rename {application => config}/config.php (48%) create mode 100644 config/cookie.php rename {application => config}/database.php (100%) create mode 100644 config/log.php create mode 100644 config/session.php create mode 100644 config/template.php create mode 100644 config/trace.php rename {application => route}/route.php (73%) diff --git a/config/cache.php b/config/cache.php new file mode 100644 index 0000000..bb28d46 --- /dev/null +++ b/config/cache.php @@ -0,0 +1,25 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 缓存设置 +// +---------------------------------------------------------------------- + +return [ + // 驱动方式 + 'type' => 'File', + // 缓存保存目录 + 'path' => '', + // 缓存前缀 + 'prefix' => '', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, +]; diff --git a/application/config.php b/config/config.php similarity index 48% rename from application/config.php rename to config/config.php index 21c0531..3584a3a 100644 --- a/application/config.php +++ b/config/config.php @@ -9,10 +9,11 @@ // | Author: liu21st // +---------------------------------------------------------------------- +// +---------------------------------------------------------------------- +// | 应用设置 +// +---------------------------------------------------------------------- + return [ - // +---------------------------------------------------------------------- - // | 应用设置 - // +---------------------------------------------------------------------- // 应用命名空间 'app_namespace' => 'app', @@ -28,8 +29,6 @@ return [ 'auto_bind_module' => false, // 注册的根命名空间 'root_namespace' => [], - // 扩展函数文件 - 'extra_file_list' => [THINK_PATH . 'helper' . EXT], // 默认输出类型 'default_return_type' => 'html', // 默认AJAX 数据返回格式,可选json xml ... @@ -51,10 +50,6 @@ return [ // 控制器类后缀 'controller_suffix' => false, - // +---------------------------------------------------------------------- - // | 模块设置 - // +---------------------------------------------------------------------- - // 默认模块名 'default_module' => 'index', // 禁止访问模块 @@ -72,10 +67,6 @@ return [ // 自动搜索控制器 'controller_auto_search' => false, - // +---------------------------------------------------------------------- - // | URL设置 - // +---------------------------------------------------------------------- - // PATHINFO变量名 用于兼容模式 'var_pathinfo' => 's', // 兼容PATH_INFO获取 @@ -92,8 +83,6 @@ return [ 'url_route_on' => true, // 路由使用完整匹配 'route_complete_match' => false, - // 路由配置文件(支持配置多个) - 'route_config_file' => ['route'], // 是否强制使用路由 'url_route_must' => false, // 域名部署 @@ -115,41 +104,14 @@ return [ // 请求缓存有效期 'request_cache_expire' => null, - // +---------------------------------------------------------------------- - // | 模板设置 - // +---------------------------------------------------------------------- - - 'template' => [ - // 模板引擎类型 支持 php think 支持扩展 - 'type' => 'Think', - // 模板路径 - 'view_path' => '', - // 模板后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DS, - // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', - // 模板引擎普通标签结束标记 - 'tpl_end' => '}', - // 标签库标签开始标记 - 'taglib_begin' => '{', - // 标签库标签结束标记 - 'taglib_end' => '}', - ], - // 视图输出字符串内容替换 'view_replace_str' => [], // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl', - 'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl', - - // +---------------------------------------------------------------------- - // | 异常及错误设置 - // +---------------------------------------------------------------------- + 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', // 异常页面的模板文件 - 'exception_tmpl' => THINK_PATH . 'tpl' . DS . 'think_exception.tpl', + 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', // 错误显示信息,非调试模式有效 'error_message' => '页面错误!请稍后再试~', @@ -158,82 +120,4 @@ return [ // 异常处理handle类 留空使用 \think\exception\Handle 'exception_handle' => '', - // +---------------------------------------------------------------------- - // | 日志设置 - // +---------------------------------------------------------------------- - - 'log' => [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - // 日志保存目录 - 'path' => LOG_PATH, - // 日志记录级别 - 'level' => [], - ], - - // +---------------------------------------------------------------------- - // | Trace设置 开启 app_trace 后 有效 - // +---------------------------------------------------------------------- - 'trace' => [ - // 内置Html Console 支持扩展 - 'type' => 'Html', - ], - - // +---------------------------------------------------------------------- - // | 缓存设置 - // +---------------------------------------------------------------------- - - 'cache' => [ - // 驱动方式 - 'type' => 'File', - // 缓存保存目录 - 'path' => CACHE_PATH, - // 缓存前缀 - 'prefix' => '', - // 缓存有效期 0表示永久缓存 - 'expire' => 0, - ], - - // +---------------------------------------------------------------------- - // | 会话设置 - // +---------------------------------------------------------------------- - - 'session' => [ - 'id' => '', - // SESSION_ID的提交变量,解决flash上传跨域 - 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'think', - // 驱动方式 支持redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, - ], - - // +---------------------------------------------------------------------- - // | Cookie设置 - // +---------------------------------------------------------------------- - 'cookie' => [ - // cookie 名称前缀 - 'prefix' => '', - // cookie 保存时间 - 'expire' => 0, - // cookie 保存路径 - 'path' => '/', - // cookie 有效域名 - 'domain' => '', - // cookie 启用安全传输 - 'secure' => false, - // httponly设置 - 'httponly' => '', - // 是否使用 setcookie - 'setcookie' => true, - ], - - //分页配置 - 'paginate' => [ - 'type' => 'bootstrap', - 'var_page' => 'page', - 'list_rows' => 15, - ], ]; diff --git a/config/cookie.php b/config/cookie.php new file mode 100644 index 0000000..123c354 --- /dev/null +++ b/config/cookie.php @@ -0,0 +1,30 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | Cookie设置 +// +---------------------------------------------------------------------- +return [ + // cookie 名称前缀 + 'prefix' => '', + // cookie 保存时间 + 'expire' => 0, + // cookie 保存路径 + 'path' => '/', + // cookie 有效域名 + 'domain' => '', + // cookie 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => '', + // 是否使用 setcookie + 'setcookie' => true, +]; diff --git a/application/database.php b/config/database.php similarity index 100% rename from application/database.php rename to config/database.php diff --git a/config/log.php b/config/log.php new file mode 100644 index 0000000..acfdb13 --- /dev/null +++ b/config/log.php @@ -0,0 +1,22 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 日志设置 +// +---------------------------------------------------------------------- +return [ + // 日志记录方式,内置 file socket 支持扩展 + 'type' => 'File', + // 日志保存目录 + 'path' => '', + // 日志记录级别 + 'level' => [], +]; diff --git a/config/session.php b/config/session.php new file mode 100644 index 0000000..521240e --- /dev/null +++ b/config/session.php @@ -0,0 +1,26 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 会话设置 +// +---------------------------------------------------------------------- + +return [ + 'id' => '', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // SESSION 前缀 + 'prefix' => 'think', + // 驱动方式 支持redis memcache memcached + 'type' => '', + // 是否自动开启 SESSION + 'auto_start' => true, +]; diff --git a/config/template.php b/config/template.php new file mode 100644 index 0000000..1d630d7 --- /dev/null +++ b/config/template.php @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 模板设置 +// +---------------------------------------------------------------------- + +return [ + // 模板引擎类型 支持 php think 支持扩展 + 'type' => 'Think', + // 模板路径 + 'view_path' => '', + // 模板后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 模板引擎普通标签开始标记 + 'tpl_begin' => '{', + // 模板引擎普通标签结束标记 + 'tpl_end' => '}', + // 标签库标签开始标记 + 'taglib_begin' => '{', + // 标签库标签结束标记 + 'taglib_end' => '}', +]; diff --git a/config/trace.php b/config/trace.php new file mode 100644 index 0000000..73012f2 --- /dev/null +++ b/config/trace.php @@ -0,0 +1,18 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | Trace设置 开启 app_trace 后 有效 +// +---------------------------------------------------------------------- +return [ + // 内置Html Console 支持扩展 + 'type' => 'Html', +]; diff --git a/application/route.php b/route/route.php similarity index 73% rename from application/route.php rename to route/route.php index f648d3b..5e2427f 100644 --- a/application/route.php +++ b/route/route.php @@ -9,13 +9,15 @@ // | Author: liu21st // +---------------------------------------------------------------------- +Route::get('/', function () { + return 'hello,ThinkPHP5!'; +}); + +Route::group('hello', function () { + Route::get(':id', 'index/hello'); + Route::post(':name', 'index/hello'); +}, [], ['id' => '\d+', 'name' => '\w+']); + return [ - '__pattern__' => [ - 'name' => '\w+', - ], - '[hello]' => [ - ':id' => ['index/hello', ['method' => 'get'], ['id' => '\d+']], - ':name' => ['index/hello', ['method' => 'post']], - ], ]; -- Gitee From 24444c897ea9b78265ff811445a64264ec36bb34 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 8 Mar 2017 15:34:49 +0800 Subject: [PATCH 002/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/Index.php | 5 +++++ config/{config.php => app.php} | 0 route/route.php | 7 ++----- 3 files changed, 7 insertions(+), 5 deletions(-) rename config/{config.php => app.php} (100%) diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 2ab0697..7ed7811 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -7,4 +7,9 @@ class Index { return '

:)

ThinkPHP V5
十年磨一剑 - 为API开发设计的高性能框架

[ V5.0 版本由 七牛云 独家赞助发布 ]
'; } + + public function hello($name = 'ThinkPHP5') + { + return 'hello,' . $name; + } } diff --git a/config/config.php b/config/app.php similarity index 100% rename from config/config.php rename to config/app.php diff --git a/route/route.php b/route/route.php index 5e2427f..3fcb53d 100644 --- a/route/route.php +++ b/route/route.php @@ -9,14 +9,11 @@ // | Author: liu21st // +---------------------------------------------------------------------- -Route::get('/', function () { +Route::get('think', function () { return 'hello,ThinkPHP5!'; }); -Route::group('hello', function () { - Route::get(':id', 'index/hello'); - Route::post(':name', 'index/hello'); -}, [], ['id' => '\d+', 'name' => '\w+']); +Route::get('hello/:name', 'index/hello'); return [ -- Gitee From 900e5a4be254f7e2bbf03ccb70ab89898c5ca0c4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 8 Mar 2017 15:54:43 +0800 Subject: [PATCH 003/186] =?UTF-8?q?readme=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 90 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 81cf109..a821e1e 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,20 @@ -ThinkPHP 5.0 +ThinkPHP 5.1Alpha =============== -[![Total Downloads](https://poser.pugx.org/topthink/think/downloads)](https://packagist.org/packages/topthink/think) -[![Latest Stable Version](https://poser.pugx.org/topthink/think/v/stable)](https://packagist.org/packages/topthink/think) -[![Latest Unstable Version](https://poser.pugx.org/topthink/think/v/unstable)](https://packagist.org/packages/topthink/think) -[![License](https://poser.pugx.org/topthink/think/license)](https://packagist.org/packages/topthink/think) - -ThinkPHP5在保持快速开发和大道至简的核心理念不变的同时,PHP版本要求提升到5.4,对已有的CBD模式做了更深的强化,优化核心,减少依赖,基于全新的架构思想和命名空间实现,是ThinkPHP突破原有框架思路的颠覆之作,其主要特性包括: - - + 基于命名空间和众多PHP新特性 - + 核心功能组件化 - + 强化路由功能 - + 更灵活的控制器 - + 重构的模型和数据库类 - + 配置文件可分离 - + 重写的自动验证和完成 - + 简化扩展机制 - + API支持完善 - + 改进的Log类 - + 命令行访问支持 - + REST支持 - + 引导文件支持 - + 方便的自动生成定义 - + 真正惰性加载 - + 分布式环境支持 - + 更多的社交类库 - -> ThinkPHP5的运行环境要求PHP5.4以上。 +ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括: + + + 采用容器统一管理对象 + + 支持Facade + + 配置和路由目录独立 + + 取消系统常量 + + 助手函数增强 + + 类库别名机制 + + 增加条件查询 + + 配置采用二级 + + 依赖注入完善 + + +> ThinkPHP5的运行环境要求PHP5.6以上。 详细开发文档参考 [ThinkPHP5完全开发手册](http://www.kancloud.cn/manual/thinkphp5) @@ -39,19 +27,34 @@ www WEB部署目录(或者子目录) ├─application 应用目录 │ ├─common 公共模块目录(可以更改) │ ├─module_name 模块目录 -│ │ ├─config.php 模块配置文件 │ │ ├─common.php 模块函数文件 │ │ ├─controller 控制器目录 │ │ ├─model 模型目录 │ │ ├─view 视图目录 │ │ └─ ... 更多类库目录 │ │ -│ ├─command.php 命令行工具配置文件 +│ ├─command.php 命令行定义文件 │ ├─common.php 公共函数文件 -│ ├─config.php 公共配置文件 -│ ├─route.php 路由配置文件 -│ ├─tags.php 应用行为扩展定义文件 -│ └─database.php 数据库配置文件 +│ └─tags.php 应用行为扩展定义文件 +│ +├─config 应用配置目录 +│ ├─module_name 模块配置目录 +│ │ ├─database.php 数据库配置 +│ │ ├─cache 缓存配置 +│ │ └─ ... +│ │ +│ ├─app.php 应用配置 +│ ├─cache.php 缓存配置 +│ ├─cookie.php Cookie配置 +│ ├─database.php 数据库配置 +│ ├─log.php 日志配置 +│ ├─session.php Session配置 +│ ├─template.php 模板引擎配置 +│ └─trace.php Trace配置 +│ +├─route 路由定义目录 +│ ├─route.php 路由定义 +│ └─... 更多 │ ├─public WEB目录(对外访问目录) │ ├─index.php 入口文件 @@ -86,6 +89,27 @@ www WEB部署目录(或者子目录) > 切换到public目录后,启动命令:php -S localhost:8888 router.php > 上面的目录结构和名称是可以改变的,这取决于你的入口文件和配置参数。 +## 升级指导 + +原有下面系统类库的命名空间需要调整: + +think\App => think\facade\App (或者 App ) +think\Cache => think\facade\Cache (或者 Cache ) +think\Config => think\facade\Config (或者 Config ) +think\Cookie => think\facade\Cookie (或者 Cookie ) +think\Debug => think\facade\Debug (或者 Debug ) +think\Hook => think\facade\Hook (或者 Hook ) +think\Lang => think\facade\Lang (或者 Lang ) +think\Log => think\facade\Log (或者 Log ) +think\Request => think\facade\Request (或者 Request ) +think\Response => think\facade\Reponse (或者 Reponse ) +think\Route => think\facade\Route (或者 Route ) +think\Session => think\facade\Session (或者 Session ) +think\Url => think\facade\Url (或者 Url ) + +原有的配置文件config.php 拆分为app.php cache.php 等独立配置文件 放入config目录。 +原有的路由定义文件route.php 移动到route目录 + ## 命名规范 `ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范,并且注意如下规范: -- Gitee From 223f499b38f0dfd45b5cdf05f76ecd64a9306efb Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 8 Mar 2017 16:34:11 +0800 Subject: [PATCH 004/186] =?UTF-8?q?readme=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a821e1e..9f24503 100644 --- a/README.md +++ b/README.md @@ -93,19 +93,19 @@ www WEB部署目录(或者子目录) 原有下面系统类库的命名空间需要调整: -think\App => think\facade\App (或者 App ) -think\Cache => think\facade\Cache (或者 Cache ) -think\Config => think\facade\Config (或者 Config ) -think\Cookie => think\facade\Cookie (或者 Cookie ) -think\Debug => think\facade\Debug (或者 Debug ) -think\Hook => think\facade\Hook (或者 Hook ) -think\Lang => think\facade\Lang (或者 Lang ) -think\Log => think\facade\Log (或者 Log ) -think\Request => think\facade\Request (或者 Request ) -think\Response => think\facade\Reponse (或者 Reponse ) -think\Route => think\facade\Route (或者 Route ) -think\Session => think\facade\Session (或者 Session ) -think\Url => think\facade\Url (或者 Url ) +* think\App => think\facade\App (或者 App ) +* think\Cache => think\facade\Cache (或者 Cache ) +* think\Config => think\facade\Config (或者 Config ) +* think\Cookie => think\facade\Cookie (或者 Cookie ) +* think\Debug => think\facade\Debug (或者 Debug ) +* think\Hook => think\facade\Hook (或者 Hook ) +* think\Lang => think\facade\Lang (或者 Lang ) +* think\Log => think\facade\Log (或者 Log ) +* think\Request => think\facade\Request (或者 Request ) +* think\Response => think\facade\Reponse (或者 Reponse ) +* think\Route => think\facade\Route (或者 Route ) +* think\Session => think\facade\Session (或者 Session ) +* think\Url => think\facade\Url (或者 Url ) 原有的配置文件config.php 拆分为app.php cache.php 等独立配置文件 放入config目录。 原有的路由定义文件route.php 移动到route目录 -- Gitee From d1a66a78d370acae256ead258e58b8c342f0ddae Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 9 Mar 2017 11:03:15 +0800 Subject: [PATCH 005/186] =?UTF-8?q?readme=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - application/index/controller/Index.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f24503..4a0b6e0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特 > ThinkPHP5的运行环境要求PHP5.6以上。 -详细开发文档参考 [ThinkPHP5完全开发手册](http://www.kancloud.cn/manual/thinkphp5) ## 目录结构 diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 7ed7811..b14158e 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -5,7 +5,7 @@ class Index { public function index() { - return '

:)

ThinkPHP V5
十年磨一剑 - 为API开发设计的高性能框架

[ V5.0 版本由 七牛云 独家赞助发布 ]
'; + return '

:)

ThinkPHP V5.1
十年磨一剑 - 为API开发设计的高性能框架

'; } public function hello($name = 'ThinkPHP5') -- Gitee From 6973a610ad4a221bab6a9b3f178cfe1eda9d980d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 23 Apr 2017 19:51:11 +0800 Subject: [PATCH 006/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/database.php b/config/database.php index 4caac2f..d12ebb0 100644 --- a/config/database.php +++ b/config/database.php @@ -50,4 +50,6 @@ return [ 'datetime_format' => 'Y-m-d H:i:s', // 是否需要进行SQL性能分析 'sql_explain' => false, + // Query类 + 'query' => '\\think\\db\\Query', ]; -- Gitee From 5ecddd8ce30e417bd2dd87f9c1ad711a94b9ae34 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 27 Apr 2017 19:13:40 +0800 Subject: [PATCH 007/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/app.php b/config/app.php index 3584a3a..7fefcec 100644 --- a/config/app.php +++ b/config/app.php @@ -15,8 +15,6 @@ return [ - // 应用命名空间 - 'app_namespace' => 'app', // 应用调试模式 'app_debug' => true, // 应用Trace -- Gitee From c8a5894f2dc90800a831fb2ffcfe84439b8a8b2b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 14 Jul 2017 10:35:41 +0800 Subject: [PATCH 008/186] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index c4de66b..146221b 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ } ], "require": { - "php": ">=5.4.0", - "topthink/framework": "^5.0" + "php": ">=5.6.0", + "topthink/framework": "^5.1" }, "extra": { "think-path": "thinkphp" -- Gitee From bcbd7916068629843266748c5a72e727690659dc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 15 Jul 2017 10:20:17 +0800 Subject: [PATCH 009/186] =?UTF-8?q?=E4=BE=9D=E8=B5=96=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=BC=80=E5=8F=91=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 146221b..3508c10 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.6.0", - "topthink/framework": "^5.1" + "topthink/framework": "^5.1@dev" }, "extra": { "think-path": "thinkphp" -- Gitee From ed1f01106ad412065b893cfd927caa83372a9a35 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 15 Jul 2017 10:41:57 +0800 Subject: [PATCH 010/186] =?UTF-8?q?=E8=B0=83=E6=95=B4composer.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3508c10..ddb891d 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.6.0", - "topthink/framework": "^5.1@dev" + "topthink/framework": "~5.1.0@dev" }, "extra": { "think-path": "thinkphp" -- Gitee From fe93a836a6a4df4421598e4f7c74d155b5ac8fb3 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 18 Jul 2017 11:02:02 +0800 Subject: [PATCH 011/186] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=B8=8D=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/app.php b/config/app.php index 7fefcec..135f32f 100644 --- a/config/app.php +++ b/config/app.php @@ -77,8 +77,6 @@ return [ 'url_common_param' => false, // URL参数方式 0 按名称成对解析 1 按顺序解析 'url_param_type' => 0, - // 是否开启路由 - 'url_route_on' => true, // 路由使用完整匹配 'route_complete_match' => false, // 是否强制使用路由 -- Gitee From d94475cf8bdb54ba2fe280a69b553f5efecdcc9b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 29 Jul 2017 08:39:23 +0800 Subject: [PATCH 012/186] =?UTF-8?q?build=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.php b/build.php index b37d3ab..d1d9e6a 100644 --- a/build.php +++ b/build.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2017 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -11,7 +11,7 @@ return [ // 生成应用公共文件 - '__file__' => ['common.php', 'config.php', 'database.php'], + '__file__' => ['common.php'], // 定义demo模块的自动生成 (按照实际定义的文件名生成) 'demo' => [ @@ -21,5 +21,6 @@ return [ 'model' => ['User', 'UserType'], 'view' => ['index/index'], ], + // 其他更多的模块定义 ]; -- Gitee From 861b31455d93b5a021697168b044f6ab5d7bc816 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 8 Sep 2017 14:42:57 +0800 Subject: [PATCH 013/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0readme=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a0b6e0..da72eef 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -ThinkPHP 5.1Alpha +ThinkPHP 5.1RC1 =============== ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括: @@ -10,6 +10,7 @@ ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特 + 助手函数增强 + 类库别名机制 + 增加条件查询 + + 改进查询机制 + 配置采用二级 + 依赖注入完善 -- Gitee From 73561b72c5f665f57edca105ec3973a60d901421 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 19 Sep 2017 18:33:53 +0800 Subject: [PATCH 014/186] =?UTF-8?q?=E6=B7=BB=E5=8A=A0autoload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index ddb891d..7001f8a 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,11 @@ "php": ">=5.6.0", "topthink/framework": "~5.1.0@dev" }, + "autoload": { + "psr-4": { + "app\\": "application" + } + }, "extra": { "think-path": "thinkphp" }, -- Gitee From 7abb2eeb76bbd9f0d7f1bdddb792941259d199c0 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 27 Sep 2017 11:17:46 +0800 Subject: [PATCH 015/186] =?UTF-8?q?=E4=B8=BA=E4=BA=86=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=8F=96=E6=B6=88APP=5FPATH=20=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E9=9C=80=E8=A6=81=E8=87=AA=E5=AE=9A=E4=B9=89=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E7=9B=AE=E5=BD=95=20=E8=87=AA=E5=B7=B1=E9=87=8D?= =?UTF-8?q?=E5=86=99=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 2 -- think | 3 --- 2 files changed, 5 deletions(-) diff --git a/public/index.php b/public/index.php index 6b7ec30..92ecfc9 100644 --- a/public/index.php +++ b/public/index.php @@ -11,7 +11,5 @@ // [ 应用入口文件 ] -// 定义应用目录 -define('APP_PATH', __DIR__ . '/../application/'); // 加载框架引导文件 require __DIR__ . '/../thinkphp/start.php'; diff --git a/think b/think index 8afa938..87eda5d 100644 --- a/think +++ b/think @@ -10,8 +10,5 @@ // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- -// 定义项目路径 -define('APP_PATH', __DIR__ . '/application/'); - // 加载框架引导文件 require './thinkphp/console.php'; \ No newline at end of file -- Gitee From d9317ee834e02b297a805f515011257ffb4c9bf9 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 29 Sep 2017 11:07:33 +0800 Subject: [PATCH 016/186] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=92=8C=E5=91=BD=E4=BB=A4=E8=A1=8C=E5=85=A5=E5=8F=A3=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 10 ++++++++-- think | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/public/index.php b/public/index.php index 92ecfc9..da22be5 100644 --- a/public/index.php +++ b/public/index.php @@ -10,6 +10,12 @@ // +---------------------------------------------------------------------- // [ 应用入口文件 ] +namespace think; -// 加载框架引导文件 -require __DIR__ . '/../thinkphp/start.php'; +// 加载基础文件 +require __DIR__ . '/../thinkphp/base.php'; + +// 支持事先使用静态方法设置Request对象和Config对象 + +// 执行应用并响应 +Container::get('app')->run()->send(); \ No newline at end of file diff --git a/think b/think index 87eda5d..05f35f8 100644 --- a/think +++ b/think @@ -10,5 +10,11 @@ // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- -// 加载框架引导文件 -require './thinkphp/console.php'; \ No newline at end of file +namespace think; + +// 加载基础文件 +require __DIR__ . '/thinkphp/base.php'; + +// 执行应用 +Container::get('app', [__DIR__ . '/application/'])->initialize(); +Console::init(); \ No newline at end of file -- Gitee From 18f1cf51d5833b72db4ad52997cd0e5107e9b09b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 23 Oct 2017 14:36:26 +0800 Subject: [PATCH 017/186] =?UTF-8?q?=E4=BF=AE=E6=AD=A3router?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/router.php b/public/router.php index 6ba1fab..80ada33 100644 --- a/public/router.php +++ b/public/router.php @@ -10,7 +10,7 @@ // +---------------------------------------------------------------------- // $Id$ -if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["REQUEST_URI"])) { +if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) { return false; } else { require __DIR__ . "/index.php"; -- Gitee From 395da848f4694172c478fe4d0bc1a5a10626cffe Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 31 Dec 2017 23:17:01 +0800 Subject: [PATCH 018/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++-- application/index/controller/Index.php | 2 +- application/tags.php | 2 +- build.php | 2 +- config/app.php | 6 +++--- config/cache.php | 2 +- config/cookie.php | 2 +- config/database.php | 2 +- config/log.php | 2 +- config/session.php | 2 +- config/template.php | 2 +- config/trace.php | 2 +- public/router.php | 2 +- route/route.php | 2 +- 14 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index da72eef..acf2d0c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -ThinkPHP 5.1RC1 +ThinkPHP 5.1 =============== ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括: + 采用容器统一管理对象 + 支持Facade + + 注解路由支持 + + 路由跨域请求支持 + 配置和路由目录独立 + 取消系统常量 + 助手函数增强 @@ -144,7 +146,7 @@ ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 本项目包含的第三方源码和二进制文件之版权信息另行标注。 -版权所有Copyright © 2006-2017 by ThinkPHP (http://thinkphp.cn) +版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn) All rights reserved。 diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index b14158e..b528a73 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -5,7 +5,7 @@ class Index { public function index() { - return '

:)

ThinkPHP V5.1
十年磨一剑 - 为API开发设计的高性能框架

'; + return '

:)

ThinkPHP V5.1
十年磨一剑 - 为API开发设计的高性能框架

'; } public function hello($name = 'ThinkPHP5') diff --git a/application/tags.php b/application/tags.php index e213e0a..4b18d10 100644 --- a/application/tags.php +++ b/application/tags.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/build.php b/build.php index d1d9e6a..34ba3c8 100644 --- a/build.php +++ b/build.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2017 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/config/app.php b/config/app.php index 135f32f..97c01d1 100644 --- a/config/app.php +++ b/config/app.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -81,6 +81,8 @@ return [ 'route_complete_match' => false, // 是否强制使用路由 'url_route_must' => false, + // 使用注解路由 + 'route_annotation' => false, // 域名部署 'url_domain_deploy' => false, // 域名根,如thinkphp.cn @@ -100,8 +102,6 @@ return [ // 请求缓存有效期 'request_cache_expire' => null, - // 视图输出字符串内容替换 - 'view_replace_str' => [], // 默认跳转页面对应的模板文件 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', diff --git a/config/cache.php b/config/cache.php index bb28d46..985dbb1 100644 --- a/config/cache.php +++ b/config/cache.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/config/cookie.php b/config/cookie.php index 123c354..1de0708 100644 --- a/config/cookie.php +++ b/config/cookie.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/config/database.php b/config/database.php index d12ebb0..ecfcd03 100644 --- a/config/database.php +++ b/config/database.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/config/log.php b/config/log.php index acfdb13..54e81ba 100644 --- a/config/log.php +++ b/config/log.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/config/session.php b/config/session.php index 521240e..1d7b6c6 100644 --- a/config/session.php +++ b/config/session.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/config/template.php b/config/template.php index 1d630d7..0877562 100644 --- a/config/template.php +++ b/config/template.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/config/trace.php b/config/trace.php index 73012f2..425d301 100644 --- a/config/trace.php +++ b/config/trace.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/public/router.php b/public/router.php index 80ada33..4f916b4 100644 --- a/public/router.php +++ b/public/router.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/route/route.php b/route/route.php index 3fcb53d..6f479d3 100644 --- a/route/route.php +++ b/route/route.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- -- Gitee From 8f3de5a7b95c21dd70e12fdf9d2779f4fbd7094f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 31 Dec 2017 23:48:09 +0800 Subject: [PATCH 019/186] =?UTF-8?q?2018=E6=96=B0=E5=B9=B4=E5=BF=AB?= =?UTF-8?q?=E4=B9=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index b528a73..2c4ed42 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -5,7 +5,7 @@ class Index { public function index() { - return '

:)

ThinkPHP V5.1
十年磨一剑 - 为API开发设计的高性能框架

'; + return '

:) 2018新年快乐

ThinkPHP V5.1
12载初心不改(2006-2018) - 你值得信赖的PHP框架

'; } public function hello($name = 'ThinkPHP5') -- Gitee From 4157806793db16a767ca1c22f234310479e573d5 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 1 Jan 2018 00:31:00 +0800 Subject: [PATCH 020/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7001f8a..361d6f6 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.6.0", - "topthink/framework": "~5.1.0@dev" + "topthink/framework": "5.1.*" }, "autoload": { "psr-4": { -- Gitee From 013e695dc383b6b82dd6df7e1251a65f91d17c1e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 25 Jan 2018 17:57:38 +0800 Subject: [PATCH 021/186] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index da22be5..22dc158 100644 --- a/public/index.php +++ b/public/index.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -18,4 +18,4 @@ require __DIR__ . '/../thinkphp/base.php'; // 支持事先使用静态方法设置Request对象和Config对象 // 执行应用并响应 -Container::get('app')->run()->send(); \ No newline at end of file +Container::get('app')->run()->send(); -- Gitee From c543914ca06a43d7e148e826f67702715c051900 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 25 Jan 2018 18:05:20 +0800 Subject: [PATCH 022/186] =?UTF-8?q?=E5=91=BD=E4=BB=A4=E8=A1=8C=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E6=96=87=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- think | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/think b/think index 05f35f8..6a923b3 100644 --- a/think +++ b/think @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -15,6 +15,8 @@ namespace think; // 加载基础文件 require __DIR__ . '/thinkphp/base.php'; -// 执行应用 -Container::get('app', [__DIR__ . '/application/'])->initialize(); +// 应用初始化 +Container::get('app')->path(__DIR__ . '/application/')->initialize(); + +// 控制台初始化 Console::init(); \ No newline at end of file -- Gitee From 5c9c48929b044d700383a2726a0dba44203e3d07 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 25 Jan 2018 18:35:27 +0800 Subject: [PATCH 023/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/app.php b/config/app.php index 97c01d1..3d140a0 100644 --- a/config/app.php +++ b/config/app.php @@ -83,8 +83,6 @@ return [ 'url_route_must' => false, // 使用注解路由 'route_annotation' => false, - // 域名部署 - 'url_domain_deploy' => false, // 域名根,如thinkphp.cn 'url_domain_root' => '', // 是否自动转换URL中的控制器和操作名 -- Gitee From fd929d6a6b0410bd7b7e9f94b6329cbaf3e41954 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 25 Jan 2018 18:40:42 +0800 Subject: [PATCH 024/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/app.php b/config/app.php index 3d140a0..a0d12e3 100644 --- a/config/app.php +++ b/config/app.php @@ -99,6 +99,8 @@ return [ 'request_cache' => false, // 请求缓存有效期 'request_cache_expire' => null, + // 全局请求缓存排除规则 + 'request_cache_except' => [], // 默认跳转页面对应的模板文件 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', -- Gitee From 80a079f43b15614297aeeda18ca1d04febf21713 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 31 Jan 2018 22:38:20 +0800 Subject: [PATCH 025/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/config/app.php b/config/app.php index 97c01d1..36c8606 100644 --- a/config/app.php +++ b/config/app.php @@ -14,9 +14,12 @@ // +---------------------------------------------------------------------- return [ - + // 应用名称 + 'app_name' => '', + // 应用地址 + 'app_host' => '', // 应用调试模式 - 'app_debug' => true, + 'app_debug' => false, // 应用Trace 'app_trace' => false, // 应用模式状态 @@ -48,6 +51,10 @@ return [ // 控制器类后缀 'controller_suffix' => false, + // +---------------------------------------------------------------------- + // | 模块设置 + // +---------------------------------------------------------------------- + // 默认模块名 'default_module' => 'index', // 禁止访问模块 @@ -58,33 +65,43 @@ return [ 'default_action' => 'index', // 默认验证器 'default_validate' => '', + // 默认的空模块名 + 'empty_module' => '', // 默认的空控制器名 'empty_controller' => 'Error', + // 操作方法前缀 + 'use_action_prefix' => false, // 操作方法后缀 'action_suffix' => '', // 自动搜索控制器 'controller_auto_search' => false, + // +---------------------------------------------------------------------- + // | URL设置 + // +---------------------------------------------------------------------- + // PATHINFO变量名 用于兼容模式 'var_pathinfo' => 's', // 兼容PATH_INFO获取 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], // pathinfo分隔符 'pathinfo_depr' => '/', + // HTTPS代理标识 + 'https_agent_name' => '', // URL伪静态后缀 'url_html_suffix' => 'html', // URL普通方式参数 用于自动生成 'url_common_param' => false, // URL参数方式 0 按名称成对解析 1 按顺序解析 'url_param_type' => 0, - // 路由使用完整匹配 - 'route_complete_match' => false, + // 是否开启路由延迟解析 + 'url_lazy_route' => false, // 是否强制使用路由 'url_route_must' => false, + // 路由是否完全匹配 + 'route_complete_match' => false, // 使用注解路由 'route_annotation' => false, - // 域名部署 - 'url_domain_deploy' => false, // 域名根,如thinkphp.cn 'url_domain_root' => '', // 是否自动转换URL中的控制器和操作名 @@ -101,6 +118,8 @@ return [ 'request_cache' => false, // 请求缓存有效期 'request_cache_expire' => null, + // 全局请求缓存排除规则 + 'request_cache_except' => [], // 默认跳转页面对应的模板文件 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', -- Gitee From 574299da62df60545df3d863627c08bbed65865f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 5 Mar 2018 13:38:22 +0800 Subject: [PATCH 026/186] =?UTF-8?q?=E6=AC=A2=E8=BF=8E=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 2c4ed42..a00d682 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -5,7 +5,7 @@ class Index { public function index() { - return '

:) 2018新年快乐

ThinkPHP V5.1
12载初心不改(2006-2018) - 你值得信赖的PHP框架

'; + return '

:)

ThinkPHP V5.1
12载初心不改(2006-2018) - 你值得信赖的PHP框架

'; } public function hello($name = 'ThinkPHP5') -- Gitee From 0e40e0b9aea9fefc4d7a7cacbd209ffdda7d9269 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 22 Mar 2018 16:30:18 +0800 Subject: [PATCH 027/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + config/app.php | 2 ++ config/database.php | 6 ++++++ config/log.php | 12 +++++++++--- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index acf2d0c..dc1c993 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特 + 改进查询机制 + 配置采用二级 + 依赖注入完善 + + 中间件支持(V5.1.6+) > ThinkPHP5的运行环境要求PHP5.6以上。 diff --git a/config/app.php b/config/app.php index 36c8606..2738e81 100644 --- a/config/app.php +++ b/config/app.php @@ -98,6 +98,8 @@ return [ 'url_lazy_route' => false, // 是否强制使用路由 'url_route_must' => false, + // 合并路由规则 + 'route_rule_merge' => false, // 路由是否完全匹配 'route_complete_match' => false, // 使用注解路由 diff --git a/config/database.php b/config/database.php index ecfcd03..a0196db 100644 --- a/config/database.php +++ b/config/database.php @@ -50,6 +50,12 @@ return [ 'datetime_format' => 'Y-m-d H:i:s', // 是否需要进行SQL性能分析 'sql_explain' => false, + // Builder类 + 'builder' => '', // Query类 'query' => '\\think\\db\\Query', + // 是否需要断线重连 + 'break_reconnect' => false, + // 断线标识字符串 + 'break_match_str' => [], ]; diff --git a/config/log.php b/config/log.php index 54e81ba..6305e75 100644 --- a/config/log.php +++ b/config/log.php @@ -14,9 +14,15 @@ // +---------------------------------------------------------------------- return [ // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', + 'type' => 'File', // 日志保存目录 - 'path' => '', + 'path' => '', // 日志记录级别 - 'level' => [], + 'level' => [], + // 单文件日志写入 + 'single' => false, + // 独立日志级别 + 'apart_level' => [], + // 最大日志文件数量 + 'max_files' => 0, ]; -- Gitee From 6a3ba0b8e52ae3337bafb97c4c730c6d484f6860 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 22 Mar 2018 17:24:07 +0800 Subject: [PATCH 028/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/app.php b/config/app.php index 2738e81..50addb8 100644 --- a/config/app.php +++ b/config/app.php @@ -39,7 +39,7 @@ return [ // 默认JSONP处理方法 'var_jsonp_handler' => 'callback', // 默认时区 - 'default_timezone' => 'PRC', + 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 'lang_switch_on' => false, // 默认全局过滤方法 用逗号分隔多个 -- Gitee From 6eda63b3d642c1bfdf6761091f7c631e8e7eecc6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 26 Mar 2018 22:53:53 +0800 Subject: [PATCH 029/186] =?UTF-8?q?.gitignore=E6=96=87=E4=BB=B6=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7846e89..a3d20e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -.idea -composer.lock +/.idea +/.vscode +/vendor *.log thinkphp +.env \ No newline at end of file -- Gitee From 313e9ae0d52ee4c8712a307e269084edec538a8b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 5 Apr 2018 11:03:31 +0800 Subject: [PATCH 030/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 -- config/console.php | 19 +++++++++++++++++++ config/log.php | 2 ++ config/template.php | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 config/console.php diff --git a/config/app.php b/config/app.php index 50addb8..9a8f2dd 100644 --- a/config/app.php +++ b/config/app.php @@ -22,8 +22,6 @@ return [ 'app_debug' => false, // 应用Trace 'app_trace' => false, - // 应用模式状态 - 'app_status' => '', // 是否支持多模块 'app_multi_module' => true, // 入口自动绑定模块 diff --git a/config/console.php b/config/console.php new file mode 100644 index 0000000..b0f9165 --- /dev/null +++ b/config/console.php @@ -0,0 +1,19 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 控制台配置 +// +---------------------------------------------------------------------- +return [ + 'name' => 'Think Console', + 'version' => '0.1', + 'user' => null, +]; diff --git a/config/log.php b/config/log.php index 6305e75..b3d87b4 100644 --- a/config/log.php +++ b/config/log.php @@ -25,4 +25,6 @@ return [ 'apart_level' => [], // 最大日志文件数量 'max_files' => 0, + // 是否关闭日志写入 + 'close' => false, ]; diff --git a/config/template.php b/config/template.php index 0877562..c6ed537 100644 --- a/config/template.php +++ b/config/template.php @@ -16,6 +16,8 @@ return [ // 模板引擎类型 支持 php think 支持扩展 'type' => 'Think', + // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 + 'auto_rule' => 1, // 模板路径 'view_path' => '', // 模板后缀 -- Gitee From 0b08e1a9f37c8cfb9ff1f76be7246f1ab1b5de02 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 14 Apr 2018 12:55:26 +0800 Subject: [PATCH 031/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/template.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/template.php b/config/template.php index 0877562..299bd6f 100644 --- a/config/template.php +++ b/config/template.php @@ -16,6 +16,8 @@ return [ // 模板引擎类型 支持 php think 支持扩展 'type' => 'Think', + // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 + 'auto_rule' => 1, // 模板路径 'view_path' => '', // 模板后缀 -- Gitee From b69fb2811577a0a53908da81120ffca5849b3616 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 19 Apr 2018 17:58:37 +0800 Subject: [PATCH 032/186] readme --- README.md | 66 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index dc1c993..6d737b0 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,7 @@ -ThinkPHP 5.1 +ThinkPHP 5.2 =============== -ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括: - - + 采用容器统一管理对象 - + 支持Facade - + 注解路由支持 - + 路由跨域请求支持 - + 配置和路由目录独立 - + 取消系统常量 - + 助手函数增强 - + 类库别名机制 - + 增加条件查询 - + 改进查询机制 - + 配置采用二级 - + 依赖注入完善 - + 中间件支持(V5.1.6+) - - -> ThinkPHP5的运行环境要求PHP5.6以上。 +> ThinkPHP5.2的运行环境要求PHP7.1+。 ## 目录结构 @@ -92,51 +75,6 @@ www WEB部署目录(或者子目录) > 切换到public目录后,启动命令:php -S localhost:8888 router.php > 上面的目录结构和名称是可以改变的,这取决于你的入口文件和配置参数。 -## 升级指导 - -原有下面系统类库的命名空间需要调整: - -* think\App => think\facade\App (或者 App ) -* think\Cache => think\facade\Cache (或者 Cache ) -* think\Config => think\facade\Config (或者 Config ) -* think\Cookie => think\facade\Cookie (或者 Cookie ) -* think\Debug => think\facade\Debug (或者 Debug ) -* think\Hook => think\facade\Hook (或者 Hook ) -* think\Lang => think\facade\Lang (或者 Lang ) -* think\Log => think\facade\Log (或者 Log ) -* think\Request => think\facade\Request (或者 Request ) -* think\Response => think\facade\Reponse (或者 Reponse ) -* think\Route => think\facade\Route (或者 Route ) -* think\Session => think\facade\Session (或者 Session ) -* think\Url => think\facade\Url (或者 Url ) - -原有的配置文件config.php 拆分为app.php cache.php 等独立配置文件 放入config目录。 -原有的路由定义文件route.php 移动到route目录 - -## 命名规范 - -`ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范,并且注意如下规范: - -### 目录和文件 - -* 目录不强制规范,驼峰和小写+下划线模式均支持; -* 类库、函数文件统一以`.php`为后缀; -* 类的文件名均以命名空间定义,并且命名空间的路径和类库文件所在路径一致; -* 类名和类文件名保持一致,统一采用驼峰法命名(首字母大写); - -### 函数和类、属性命名 -* 类的命名采用驼峰法,并且首字母大写,例如 `User`、`UserType`,默认不需要添加后缀,例如`UserController`应该直接命名为`User`; -* 函数的命名使用小写字母和下划线(小写字母开头)的方式,例如 `get_client_ip`; -* 方法的命名使用驼峰法,并且首字母小写,例如 `getUserName`; -* 属性的命名使用驼峰法,并且首字母小写,例如 `tableName`、`instance`; -* 以双下划线“__”打头的函数或方法作为魔法方法,例如 `__call` 和 `__autoload`; - -### 常量和配置 -* 常量以大写字母和下划线命名,例如 `APP_PATH`和 `THINK_PATH`; -* 配置参数以小写字母和下划线命名,例如 `url_route_on` 和`url_convert`; - -### 数据表和字段 -* 数据表和字段采用小写加下划线方式命名,并注意字段名不要以下划线开头,例如 `think_user` 表和 `user_name`字段,不建议使用驼峰和中文作为数据表字段命名。 ## 参与开发 请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)。 -- Gitee From 904dbe4f0e9e6db3f66b4125afb244a8fcc18526 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 1 May 2018 17:20:13 +0800 Subject: [PATCH 033/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 4 ++-- public/index.php | 4 +--- think | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 361d6f6..e3b106e 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ } ], "require": { - "php": ">=5.6.0", - "topthink/framework": "5.1.*" + "php": ">=7.1.0", + "topthink/framework": "5.2.*" }, "autoload": { "psr-4": { diff --git a/public/index.php b/public/index.php index 22dc158..bbb7bb5 100644 --- a/public/index.php +++ b/public/index.php @@ -15,7 +15,5 @@ namespace think; // 加载基础文件 require __DIR__ . '/../thinkphp/base.php'; -// 支持事先使用静态方法设置Request对象和Config对象 - // 执行应用并响应 -Container::get('app')->run()->send(); +App::getInstance()->run()->send(); diff --git a/think b/think index 6a923b3..3473749 100644 --- a/think +++ b/think @@ -16,7 +16,7 @@ namespace think; require __DIR__ . '/thinkphp/base.php'; // 应用初始化 -Container::get('app')->path(__DIR__ . '/application/')->initialize(); +App::getInstance()->path(__DIR__ . '/application/')->initialize(); // 控制台初始化 Console::init(); \ No newline at end of file -- Gitee From dce9ea96cdb3e868b500764e1c2171e76855802a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 11 Sep 2018 16:27:03 +0800 Subject: [PATCH 034/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 5 +---- public/index.php | 8 ++++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index e3b106e..042ad16 100644 --- a/composer.json +++ b/composer.json @@ -17,16 +17,13 @@ ], "require": { "php": ">=7.1.0", - "topthink/framework": "5.2.*" + "topthink/framework": "5.2.*-dev" }, "autoload": { "psr-4": { "app\\": "application" } }, - "extra": { - "think-path": "thinkphp" - }, "config": { "preferred-install": "dist" } diff --git a/public/index.php b/public/index.php index bbb7bb5..9823022 100644 --- a/public/index.php +++ b/public/index.php @@ -12,8 +12,12 @@ // [ 应用入口文件 ] namespace think; +// 使用composer自动加载 +require __DIR__ . '/../vendor/autoload.php'; + +// 不使用composer自动加载 // 加载基础文件 -require __DIR__ . '/../thinkphp/base.php'; +//require __DIR__ . '/../thinkphp/base.php'; // 执行应用并响应 -App::getInstance()->run()->send(); +(new App())->run()->send(); -- Gitee From 44cc196bac8c39170df54a07f567a6be5ba861f1 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 11 Sep 2018 16:59:50 +0800 Subject: [PATCH 035/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/public/index.php b/public/index.php index 9823022..9a5350c 100644 --- a/public/index.php +++ b/public/index.php @@ -15,9 +15,5 @@ namespace think; // 使用composer自动加载 require __DIR__ . '/../vendor/autoload.php'; -// 不使用composer自动加载 -// 加载基础文件 -//require __DIR__ . '/../thinkphp/base.php'; - // 执行应用并响应 (new App())->run()->send(); -- Gitee From 55410113af0218f1645e559c15a3e4adc8c42e69 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 11 Sep 2018 17:29:45 +0800 Subject: [PATCH 036/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index 9a5350c..49c322c 100644 --- a/public/index.php +++ b/public/index.php @@ -12,8 +12,15 @@ // [ 应用入口文件 ] namespace think; -// 使用composer自动加载 -require __DIR__ . '/../vendor/autoload.php'; +require __DIR__ . '/../vendor/topthink/framework/src/library/think/Loader.php'; + +// 注册框架自动加载 +Loader::register(); + +// 如果需要使用composer自动加载 +// Loader::register(true); +// 或者纯粹使用composer自动加载 +// require __DIR__ . '/../vendor/autoload.php'; // 执行应用并响应 (new App())->run()->send(); -- Gitee From ccb5773702d62d670ec84470f93fe06bb3e74b12 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 11 Sep 2018 17:49:26 +0800 Subject: [PATCH 037/186] =?UTF-8?q?=E7=9B=AE=E5=BD=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {application => app}/.htaccess | 0 {application => app}/command.php | 0 {application => app}/common.php | 0 {application => app}/index/controller/Index.php | 0 {application => app}/tags.php | 0 composer.json | 2 +- 6 files changed, 1 insertion(+), 1 deletion(-) rename {application => app}/.htaccess (100%) rename {application => app}/command.php (100%) rename {application => app}/common.php (100%) rename {application => app}/index/controller/Index.php (100%) rename {application => app}/tags.php (100%) diff --git a/application/.htaccess b/app/.htaccess similarity index 100% rename from application/.htaccess rename to app/.htaccess diff --git a/application/command.php b/app/command.php similarity index 100% rename from application/command.php rename to app/command.php diff --git a/application/common.php b/app/common.php similarity index 100% rename from application/common.php rename to app/common.php diff --git a/application/index/controller/Index.php b/app/index/controller/Index.php similarity index 100% rename from application/index/controller/Index.php rename to app/index/controller/Index.php diff --git a/application/tags.php b/app/tags.php similarity index 100% rename from application/tags.php rename to app/tags.php diff --git a/composer.json b/composer.json index 042ad16..92e6493 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "autoload": { "psr-4": { - "app\\": "application" + "app\\": "app" } }, "config": { -- Gitee From 67f20e56382c454c6440d77813507cd4f13e7c36 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 11 Sep 2018 18:05:13 +0800 Subject: [PATCH 038/186] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index a00d682..a3fc5fa 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -5,7 +5,7 @@ class Index { public function index() { - return '

:)

ThinkPHP V5.1
12载初心不改(2006-2018) - 你值得信赖的PHP框架

'; + return '

:)

ThinkPHP V5.2
12载初心不改 - 你值得信赖的PHP框架

'; } public function hello($name = 'ThinkPHP5') -- Gitee From 1a596dca54a73628801c1cb2cbc773f8baa6282e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 12 Sep 2018 21:07:41 +0800 Subject: [PATCH 039/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/public/index.php b/public/index.php index 49c322c..c928505 100644 --- a/public/index.php +++ b/public/index.php @@ -12,15 +12,7 @@ // [ 应用入口文件 ] namespace think; -require __DIR__ . '/../vendor/topthink/framework/src/library/think/Loader.php'; - -// 注册框架自动加载 -Loader::register(); - -// 如果需要使用composer自动加载 -// Loader::register(true); -// 或者纯粹使用composer自动加载 -// require __DIR__ . '/../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; // 执行应用并响应 (new App())->run()->send(); -- Gitee From 5b8caa61d2853633e4634a632ffc7fecd6027fe9 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 12 Sep 2018 21:24:15 +0800 Subject: [PATCH 040/186] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 92e6493..19a757a 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,10 @@ "autoload": { "psr-4": { "app\\": "app" - } + }, + "psr-0":{ + "": "extend/" + } }, "config": { "preferred-install": "dist" -- Gitee From a416c37444673b5aee90cc2fad0952e1623f5c81 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 12 Sep 2018 22:07:10 +0800 Subject: [PATCH 041/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 +- route/route.php | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/config/app.php b/config/app.php index 9a8f2dd..f09a78a 100644 --- a/config/app.php +++ b/config/app.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- - +use think\facade\Env; // +---------------------------------------------------------------------- // | 应用设置 // +---------------------------------------------------------------------- diff --git a/route/route.php b/route/route.php index 6f479d3..25cb2bd 100644 --- a/route/route.php +++ b/route/route.php @@ -8,13 +8,10 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- +use think\facade\Route; Route::get('think', function () { return 'hello,ThinkPHP5!'; }); Route::get('hello/:name', 'index/hello'); - -return [ - -]; -- Gitee From 5066c600ef3d00b3a388853d57bbcacfa3496a60 Mon Sep 17 00:00:00 2001 From: ThinkPHP Date: Wed, 12 Sep 2018 14:07:32 +0000 Subject: [PATCH 042/186] Apply fixes from StyleCI --- config/app.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/app.php b/config/app.php index f09a78a..ef7d393 100644 --- a/config/app.php +++ b/config/app.php @@ -9,6 +9,7 @@ // | Author: liu21st // +---------------------------------------------------------------------- use think\facade\Env; + // +---------------------------------------------------------------------- // | 应用设置 // +---------------------------------------------------------------------- -- Gitee From 96394f4de73b3e62a1382772e01a343818bc0b6d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 12 Sep 2018 22:12:57 +0800 Subject: [PATCH 043/186] =?UTF-8?q?readme=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 74 ++++++------------------------------------------------- 1 file changed, 7 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 6d737b0..0b8f573 100644 --- a/README.md +++ b/README.md @@ -4,79 +4,19 @@ ThinkPHP 5.2 > ThinkPHP5.2的运行环境要求PHP7.1+。 -## 目录结构 - -初始的目录结构如下: +## 安装 ~~~ -www WEB部署目录(或者子目录) -├─application 应用目录 -│ ├─common 公共模块目录(可以更改) -│ ├─module_name 模块目录 -│ │ ├─common.php 模块函数文件 -│ │ ├─controller 控制器目录 -│ │ ├─model 模型目录 -│ │ ├─view 视图目录 -│ │ └─ ... 更多类库目录 -│ │ -│ ├─command.php 命令行定义文件 -│ ├─common.php 公共函数文件 -│ └─tags.php 应用行为扩展定义文件 -│ -├─config 应用配置目录 -│ ├─module_name 模块配置目录 -│ │ ├─database.php 数据库配置 -│ │ ├─cache 缓存配置 -│ │ └─ ... -│ │ -│ ├─app.php 应用配置 -│ ├─cache.php 缓存配置 -│ ├─cookie.php Cookie配置 -│ ├─database.php 数据库配置 -│ ├─log.php 日志配置 -│ ├─session.php Session配置 -│ ├─template.php 模板引擎配置 -│ └─trace.php Trace配置 -│ -├─route 路由定义目录 -│ ├─route.php 路由定义 -│ └─... 更多 -│ -├─public WEB目录(对外访问目录) -│ ├─index.php 入口文件 -│ ├─router.php 快速测试文件 -│ └─.htaccess 用于apache的重写 -│ -├─thinkphp 框架系统目录 -│ ├─lang 语言文件目录 -│ ├─library 框架类库目录 -│ │ ├─think Think类库包目录 -│ │ └─traits 系统Trait目录 -│ │ -│ ├─tpl 系统模板目录 -│ ├─base.php 基础定义文件 -│ ├─console.php 控制台入口文件 -│ ├─convention.php 框架惯例配置文件 -│ ├─helper.php 助手函数文件 -│ ├─phpunit.xml phpunit配置文件 -│ └─start.php 框架入口文件 -│ -├─extend 扩展类库目录 -├─runtime 应用的运行时目录(可写,可定制) -├─vendor 第三方类库目录(Composer依赖库) -├─build.php 自动生成定义文件(参考) -├─composer.json composer 定义文件 -├─LICENSE.txt 授权说明文件 -├─README.md README 文件 -├─think 命令行入口文件 +composer create-project topthink/think tp5 5.2.*-dev ~~~ -> router.php用于php自带webserver支持,可用于快速测试 -> 切换到public目录后,启动命令:php -S localhost:8888 router.php -> 上面的目录结构和名称是可以改变的,这取决于你的入口文件和配置参数。 - +如果需要更新框架使用 +~~~ +composer update topthink/framework +~~~ ## 参与开发 + 请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)。 ## 版权信息 -- Gitee From d569735c021fba1a867bf59dcab1dd84bb960e78 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 14 Sep 2018 16:06:36 +0800 Subject: [PATCH 044/186] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/{index => }/controller/Index.php | 2 +- config/app.php | 15 ++------------- think | 4 ++-- 3 files changed, 5 insertions(+), 16 deletions(-) rename app/{index => }/controller/Index.php (96%) diff --git a/app/index/controller/Index.php b/app/controller/Index.php similarity index 96% rename from app/index/controller/Index.php rename to app/controller/Index.php index a3fc5fa..4e28fc9 100644 --- a/app/index/controller/Index.php +++ b/app/controller/Index.php @@ -1,5 +1,5 @@ false, // 是否支持多模块 'app_multi_module' => true, - // 入口自动绑定模块 - 'auto_bind_module' => false, - // 注册的根命名空间 - 'root_namespace' => [], + // 注册的应用命名空间 + 'app_namespace' => [], // 默认输出类型 'default_return_type' => 'html', // 默认AJAX 数据返回格式,可选json xml ... @@ -49,13 +47,6 @@ return [ 'class_suffix' => false, // 控制器类后缀 'controller_suffix' => false, - - // +---------------------------------------------------------------------- - // | 模块设置 - // +---------------------------------------------------------------------- - - // 默认模块名 - 'default_module' => 'index', // 禁止访问模块 'deny_module_list' => ['common'], // 默认控制器名 @@ -64,8 +55,6 @@ return [ 'default_action' => 'index', // 默认验证器 'default_validate' => '', - // 默认的空模块名 - 'empty_module' => '', // 默认的空控制器名 'empty_controller' => 'Error', // 操作方法前缀 diff --git a/think b/think index 3473749..b00516f 100644 --- a/think +++ b/think @@ -13,10 +13,10 @@ namespace think; // 加载基础文件 -require __DIR__ . '/thinkphp/base.php'; +require __DIR__ . '/vendor/autoload.php'; // 应用初始化 -App::getInstance()->path(__DIR__ . '/application/')->initialize(); +(new App())->initialize(); // 控制台初始化 Console::init(); \ No newline at end of file -- Gitee From 2bb39d0bd929644bfd5e9695ee5667ef834794a6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 14 Sep 2018 16:14:35 +0800 Subject: [PATCH 045/186] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route/{route.php => app.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename route/{route.php => app.php} (100%) diff --git a/route/route.php b/route/app.php similarity index 100% rename from route/route.php rename to route/app.php -- Gitee From 5376d841f9b76b12a3dcb5848810591df33b213f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 15 Sep 2018 23:46:49 +0800 Subject: [PATCH 046/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/app.php b/config/app.php index 16fa037..b20de79 100644 --- a/config/app.php +++ b/config/app.php @@ -23,10 +23,10 @@ return [ 'app_debug' => false, // 应用Trace 'app_trace' => false, - // 是否支持多模块 - 'app_multi_module' => true, - // 注册的应用命名空间 - 'app_namespace' => [], + // 应用根命名空间 + 'root_namespace' => 'app', + // 应用命名空间 + 'app_namespace' => '', // 默认输出类型 'default_return_type' => 'html', // 默认AJAX 数据返回格式,可选json xml ... -- Gitee From b3352e22f57bc849feaffb3eae94048c2ee37b8a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 16 Oct 2018 15:55:35 +0800 Subject: [PATCH 047/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=83=AF=E4=BE=8B?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convention.php | 306 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 convention.php diff --git a/convention.php b/convention.php new file mode 100644 index 0000000..b6e4107 --- /dev/null +++ b/convention.php @@ -0,0 +1,306 @@ + [ + // 应用名称 + 'app_name' => '', + // 应用地址 + 'app_host' => '', + // 应用调试模式 + 'app_debug' => false, + // 应用Trace + 'app_trace' => false, + // 应用模式状态 + 'app_status' => '', + // 是否支持多模块 + 'app_multi' => true, + // 应用根命名空间 + 'root_namespace' => 'app', + // 应用命名空间 + 'app_namespace' => '', + // 默认输出类型 + 'default_return_type' => 'html', + // 默认AJAX 数据返回格式,可选json xml ... + 'default_ajax_return' => 'json', + // 默认JSONP格式返回的处理方法 + 'default_jsonp_handler' => 'jsonpReturn', + // 默认JSONP处理方法 + 'var_jsonp_handler' => 'callback', + // 默认时区 + 'default_timezone' => 'Asia/Shanghai', + // 是否开启多语言 + 'lang_switch_on' => false, + // 默认全局过滤方法 用逗号分隔多个 + 'default_filter' => '', + // 默认语言 + 'default_lang' => 'zh-cn', + // 应用类库后缀 + 'class_suffix' => false, + // 控制器类后缀 + 'controller_suffix' => false, + + // +---------------------------------------------------------------------- + // | 模块设置 + // +---------------------------------------------------------------------- + + // 允许访问模块 + 'allow_app_list' => [], + // 禁止访问模块 + 'deny_app_list' => ['base'], + // 默认控制器名 + 'default_controller' => 'Index', + // 默认操作名 + 'default_action' => 'index', + // 默认验证器 + 'default_validate' => '', + // 默认的空控制器名 + 'empty_controller' => 'Error', + // 操作方法前缀 + 'use_action_prefix' => false, + // 操作方法后缀 + 'action_suffix' => '', + // 自动搜索控制器 + 'controller_auto_search' => false, + + // +---------------------------------------------------------------------- + // | URL设置 + // +---------------------------------------------------------------------- + + // PATHINFO变量名 用于兼容模式 + 'var_pathinfo' => 's', + // 兼容PATH_INFO获取 + 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], + // pathinfo分隔符 + 'pathinfo_depr' => '/', + // HTTPS代理标识 + 'https_agent_name' => '', + // IP代理获取标识 + 'http_agent_ip' => 'HTTP_X_REAL_IP', + // URL伪静态后缀 + 'url_html_suffix' => 'html', + // URL普通方式参数 用于自动生成 + 'url_common_param' => false, + // URL参数方式 0 按名称成对解析 1 按顺序解析 + 'url_param_type' => 0, + // 是否开启路由延迟解析 + 'url_lazy_route' => false, + // 是否强制使用路由 + 'url_route_must' => false, + // 合并路由规则 + 'route_rule_merge' => false, + // 路由是否完全匹配 + 'route_complete_match' => false, + // 使用注解路由 + 'route_annotation' => false, + // 域名根,如thinkphp.cn + 'url_domain_root' => '', + // 是否自动转换URL中的控制器和操作名 + 'url_convert' => true, + // 默认的路由变量规则 + 'default_route_pattern' => '\w+', + // 默认的访问控制器层 + 'url_controller_layer' => 'controller', + // 表单请求类型伪装变量 + 'var_method' => '_method', + // 表单ajax伪装变量 + 'var_ajax' => '_ajax', + // 表单pjax伪装变量 + 'var_pjax' => '_pjax', + // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 + 'request_cache' => false, + // 请求缓存有效期 + 'request_cache_expire' => null, + // 全局请求缓存排除规则 + 'request_cache_except' => [], + + // 默认跳转页面对应的模板文件 + 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => Env::get('think_path') . '/tpl/dispatch_jump.tpl', + + // +---------------------------------------------------------------------- + // | 异常及错误设置 + // +---------------------------------------------------------------------- + + // 异常页面的模板文件 + 'exception_tmpl' => Env::get('think_path') . '/tpl/think_exception.tpl', + + // 错误显示信息,非调试模式有效 + 'error_message' => '页面错误!请稍后再试~', + // 显示错误信息 + 'show_error_msg' => false, + // 异常处理handle类 留空使用 \think\exception\Handle + 'exception_handle' => '', + ], + + // +---------------------------------------------------------------------- + // | 模板设置 + // +---------------------------------------------------------------------- + + 'template' => [ + // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 + 'auto_rule' => 1, + // 模板引擎类型 支持 php think 支持扩展 + 'type' => 'Think', + // 视图基础目录,配置目录为所有模块的视图起始目录 + 'view_base' => '', + // 当前模板的视图目录 留空为自动获取 + 'view_path' => '', + // 模板后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 模板引擎普通标签开始标记 + 'tpl_begin' => '{', + // 模板引擎普通标签结束标记 + 'tpl_end' => '}', + // 标签库标签开始标记 + 'taglib_begin' => '{', + // 标签库标签结束标记 + 'taglib_end' => '}', + ], + + // +---------------------------------------------------------------------- + // | 日志设置 + // +---------------------------------------------------------------------- + + 'log' => [ + // 日志记录方式,内置 file socket 支持扩展 + 'type' => 'File', + // 日志保存目录 + //'path' => LOG_PATH, + // 日志记录级别 + 'level' => [], + // 是否记录trace信息到日志 + 'record_trace' => false, + ], + + // +---------------------------------------------------------------------- + // | Trace设置 开启 app_trace 后 有效 + // +---------------------------------------------------------------------- + 'trace' => [ + // 内置Html Console 支持扩展 + 'type' => 'Html', + 'file' => Env::get('think_path') . '/tpl/page_trace.tpl', + ], + + // +---------------------------------------------------------------------- + // | 缓存设置 + // +---------------------------------------------------------------------- + + 'cache' => [ + // 驱动方式 + 'type' => 'File', + // 缓存保存目录 + //'path' => CACHE_PATH, + // 缓存前缀 + 'prefix' => '', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, + ], + + // +---------------------------------------------------------------------- + // | 会话设置 + // +---------------------------------------------------------------------- + + 'session' => [ + 'id' => '', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // SESSION 前缀 + 'prefix' => 'think', + // 驱动方式 支持redis memcache memcached + 'type' => '', + // 是否自动开启 SESSION + 'auto_start' => true, + 'httponly' => true, + 'secure' => false, + ], + + // +---------------------------------------------------------------------- + // | Cookie设置 + // +---------------------------------------------------------------------- + 'cookie' => [ + // cookie 名称前缀 + 'prefix' => '', + // cookie 保存时间 + 'expire' => 0, + // cookie 保存路径 + 'path' => '/', + // cookie 有效域名 + 'domain' => '', + // cookie 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => '', + // 是否使用 setcookie + 'setcookie' => true, + ], + + // +---------------------------------------------------------------------- + // | 数据库设置 + // +---------------------------------------------------------------------- + + 'database' => [ + // 数据库类型 + 'type' => 'mysql', + // 数据库连接DSN配置 + 'dsn' => '', + // 服务器地址 + 'hostname' => '127.0.0.1', + // 数据库名 + 'database' => '', + // 数据库用户名 + 'username' => 'root', + // 数据库密码 + 'password' => '', + // 数据库连接端口 + 'hostport' => '', + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => 'utf8', + // 数据库表前缀 + 'prefix' => '', + // 数据库调试模式 + 'debug' => false, + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 数据集返回类型 + 'resultset_type' => 'array', + // 自动写入时间戳字段 + 'auto_timestamp' => false, + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + // 是否需要进行SQL性能分析 + 'sql_explain' => false, + // 查询对象 + 'query' => '\\think\\db\\Query', + ], + + //分页配置 + 'paginate' => [ + 'type' => 'bootstrap', + 'var_page' => 'page', + 'list_rows' => 15, + ], + + //控制台配置 + 'console' => [ + 'name' => 'Think Console', + 'version' => '0.1', + 'user' => null, + ], +]; -- Gitee From ff8e6a8f33c0dd2ccca17ea2a23fb32b67f6621a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 16 Oct 2018 16:46:53 +0800 Subject: [PATCH 048/186] =?UTF-8?q?=E6=83=AF=E4=BE=8B=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convention.php | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/convention.php b/convention.php index b6e4107..5278afc 100644 --- a/convention.php +++ b/convention.php @@ -11,17 +11,13 @@ return [ 'app_name' => '', // 应用地址 'app_host' => '', - // 应用调试模式 + // 应用调试模式(环境变量优先) 'app_debug' => false, - // 应用Trace + // 应用Trace(环境变量优先) 'app_trace' => false, - // 应用模式状态 - 'app_status' => '', - // 是否支持多模块 - 'app_multi' => true, // 应用根命名空间 'root_namespace' => 'app', - // 应用命名空间 + // 应用命名空间(仅在多应用架构有效 请在具体的应用配置中设置) 'app_namespace' => '', // 默认输出类型 'default_return_type' => 'html', @@ -35,23 +31,14 @@ return [ 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 'lang_switch_on' => false, - // 默认全局过滤方法 用逗号分隔多个 - 'default_filter' => '', + // 默认全局过滤方法 + 'default_filter' => [], // 默认语言 'default_lang' => 'zh-cn', // 应用类库后缀 'class_suffix' => false, // 控制器类后缀 'controller_suffix' => false, - - // +---------------------------------------------------------------------- - // | 模块设置 - // +---------------------------------------------------------------------- - - // 允许访问模块 - 'allow_app_list' => [], - // 禁止访问模块 - 'deny_app_list' => ['base'], // 默认控制器名 'default_controller' => 'Index', // 默认操作名 @@ -60,15 +47,11 @@ return [ 'default_validate' => '', // 默认的空控制器名 'empty_controller' => 'Error', - // 操作方法前缀 - 'use_action_prefix' => false, - // 操作方法后缀 - 'action_suffix' => '', // 自动搜索控制器 'controller_auto_search' => false, // +---------------------------------------------------------------------- - // | URL设置 + // | URL及路由设置 // +---------------------------------------------------------------------- // PATHINFO变量名 用于兼容模式 @@ -171,12 +154,25 @@ return [ 'log' => [ // 日志记录方式,内置 file socket 支持扩展 'type' => 'File', - // 日志保存目录 - //'path' => LOG_PATH, + // 日志记录级别 'level' => [], // 是否记录trace信息到日志 'record_trace' => false, + + // 以下配置仅对文件方式日志有效 + // 是否为单日志文件 + 'single' => false, + // 日志文件最大限制 + 'file_size' => 2097152, + // 日志目录 + 'path' => '', + // 独立日志文件类型 + 'apart_level' => [], + // 最大日志数量 + 'max_files' => 0, + // 是否JSON格式记录 + 'json' => false, ], // +---------------------------------------------------------------------- -- Gitee From 162985726176467d24c264103570101a0ff76697 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 4 Nov 2018 22:02:03 +0800 Subject: [PATCH 049/186] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/{tags.php => event.php} | 29 +++++++++++++++-------------- config/app.php | 2 -- convention.php | 6 +++--- 3 files changed, 18 insertions(+), 19 deletions(-) rename app/{tags.php => event.php} (64%) diff --git a/app/tags.php b/app/event.php similarity index 64% rename from app/tags.php rename to app/event.php index 4b18d10..aabf4d5 100644 --- a/app/tags.php +++ b/app/event.php @@ -11,18 +11,19 @@ // 应用行为扩展定义文件 return [ - // 应用初始化 - 'app_init' => [], - // 应用开始 - 'app_begin' => [], - // 模块初始化 - 'module_init' => [], - // 操作开始执行 - 'action_begin' => [], - // 视图内容过滤 - 'view_filter' => [], - // 日志写入 - 'log_write' => [], - // 应用结束 - 'app_end' => [], + 'bind' => [ + ], + 'listen' => [ + 'AppInit' => [], + 'AppBegin' => [], + 'ActionBegin' => [], + 'AppEnd' => [], + 'LogLevel' => [], + 'LogWrite' => [], + 'ViewFilter' => [], + 'ResponseSend' => [], + 'ResponseEnd' => [], + ], + 'subscribe' => [ + ], ]; diff --git a/config/app.php b/config/app.php index b20de79..afc994b 100644 --- a/config/app.php +++ b/config/app.php @@ -47,8 +47,6 @@ return [ 'class_suffix' => false, // 控制器类后缀 'controller_suffix' => false, - // 禁止访问模块 - 'deny_module_list' => ['common'], // 默认控制器名 'default_controller' => 'Index', // 默认操作名 diff --git a/convention.php b/convention.php index 5278afc..6ca7aea 100644 --- a/convention.php +++ b/convention.php @@ -103,14 +103,14 @@ return [ // 默认跳转页面对应的模板文件 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . '/tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', // +---------------------------------------------------------------------- // | 异常及错误设置 // +---------------------------------------------------------------------- // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . '/tpl/think_exception.tpl', + 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', // 错误显示信息,非调试模式有效 'error_message' => '页面错误!请稍后再试~', @@ -181,7 +181,7 @@ return [ 'trace' => [ // 内置Html Console 支持扩展 'type' => 'Html', - 'file' => Env::get('think_path') . '/tpl/page_trace.tpl', + 'file' => Env::get('think_path') . 'tpl/page_trace.tpl', ], // +---------------------------------------------------------------------- -- Gitee From 9e43ac2d4740718886edb6d968387a11a854c8d2 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 6 Nov 2018 13:14:11 +0800 Subject: [PATCH 050/186] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cookie.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cookie.php b/config/cookie.php index 1de0708..95bff33 100644 --- a/config/cookie.php +++ b/config/cookie.php @@ -24,7 +24,7 @@ return [ // cookie 启用安全传输 'secure' => false, // httponly设置 - 'httponly' => '', + 'httponly' => false, // 是否使用 setcookie 'setcookie' => true, ]; -- Gitee From 3eab5158b4f19abffdf42b0299628cc37945ec58 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 6 Nov 2018 16:00:38 +0800 Subject: [PATCH 051/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/session.php | 5 +++-- convention.php | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/session.php b/config/session.php index 1d7b6c6..38ebaf4 100644 --- a/config/session.php +++ b/config/session.php @@ -17,10 +17,11 @@ return [ 'id' => '', // SESSION_ID的提交变量,解决flash上传跨域 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'think', // 驱动方式 支持redis memcache memcached 'type' => '', // 是否自动开启 SESSION 'auto_start' => true, + // Session配置参数 + 'options' => [ + ], ]; diff --git a/convention.php b/convention.php index 6ca7aea..22accdd 100644 --- a/convention.php +++ b/convention.php @@ -207,14 +207,13 @@ return [ 'id' => '', // SESSION_ID的提交变量,解决flash上传跨域 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'think', // 驱动方式 支持redis memcache memcached 'type' => '', // 是否自动开启 SESSION 'auto_start' => true, - 'httponly' => true, - 'secure' => false, + // Session配置参数 + 'options' => [ + ], ], // +---------------------------------------------------------------------- -- Gitee From 4a9921380df9f813e4fa925b387ecd79fa0ac023 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 8 Nov 2018 18:03:01 +0800 Subject: [PATCH 052/186] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=A1=8C=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- think | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/think b/think index b00516f..0d0e28b 100644 --- a/think +++ b/think @@ -16,7 +16,7 @@ namespace think; require __DIR__ . '/vendor/autoload.php'; // 应用初始化 -(new App())->initialize(); +(new App())->multi(false)->initialize(); // 控制台初始化 Console::init(); \ No newline at end of file -- Gitee From e9573ac3839240e10bdf0a0deb395a28ff4e84bd Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 12 Dec 2018 17:58:59 +0800 Subject: [PATCH 053/186] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/event.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/event.php b/app/event.php index aabf4d5..10c7591 100644 --- a/app/event.php +++ b/app/event.php @@ -9,13 +9,18 @@ // | Author: liu21st // +---------------------------------------------------------------------- -// 应用行为扩展定义文件 +// 事件定义文件 return [ 'bind' => [ ], 'listen' => [ - 'AppInit' => [], - 'AppBegin' => [], + 'AppInit' => [ + 'think\listener\LoadLangPack', + 'think\listener\RouteCheck', + ], + 'AppBegin' => [ + 'think\listener\CheckRequestCache', + ], 'ActionBegin' => [], 'AppEnd' => [], 'LogLevel' => [], -- Gitee From 6b771e06b63de7cd9bdbc5c2045d2d4a70897e26 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 24 Dec 2018 21:56:05 +0800 Subject: [PATCH 054/186] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convention.php | 100 ++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 52 deletions(-) diff --git a/convention.php b/convention.php index 22accdd..37545ad 100644 --- a/convention.php +++ b/convention.php @@ -8,116 +8,112 @@ return [ // +---------------------------------------------------------------------- 'app' => [ // 应用名称 - 'app_name' => '', + 'app_name' => '', // 应用地址 - 'app_host' => '', + 'app_host' => '', // 应用调试模式(环境变量优先) - 'app_debug' => false, + 'app_debug' => false, // 应用Trace(环境变量优先) - 'app_trace' => false, + 'app_trace' => false, // 应用根命名空间 - 'root_namespace' => 'app', + 'root_namespace' => 'app', // 应用命名空间(仅在多应用架构有效 请在具体的应用配置中设置) - 'app_namespace' => '', + 'app_namespace' => '', // 默认输出类型 - 'default_return_type' => 'html', + 'default_return_type' => 'html', // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', + 'default_ajax_return' => 'json', // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', + 'default_jsonp_handler' => 'jsonpReturn', // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', + 'var_jsonp_handler' => 'callback', // 默认时区 - 'default_timezone' => 'Asia/Shanghai', + 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 - 'lang_switch_on' => false, + 'lang_switch_on' => false, // 默认全局过滤方法 - 'default_filter' => [], + 'default_filter' => [], // 默认语言 - 'default_lang' => 'zh-cn', + 'default_lang' => 'zh-cn', // 应用类库后缀 - 'class_suffix' => false, - // 控制器类后缀 - 'controller_suffix' => false, + 'class_suffix' => false, // 默认控制器名 - 'default_controller' => 'Index', + 'default_controller' => 'Index', // 默认操作名 - 'default_action' => 'index', + 'default_action' => 'index', // 默认验证器 - 'default_validate' => '', + 'default_validate' => '', // 默认的空控制器名 - 'empty_controller' => 'Error', - // 自动搜索控制器 - 'controller_auto_search' => false, + 'empty_controller' => 'Error', // +---------------------------------------------------------------------- // | URL及路由设置 // +---------------------------------------------------------------------- // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', + 'var_pathinfo' => 's', // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], + 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], // pathinfo分隔符 - 'pathinfo_depr' => '/', + 'pathinfo_depr' => '/', // HTTPS代理标识 - 'https_agent_name' => '', + 'https_agent_name' => '', // IP代理获取标识 - 'http_agent_ip' => 'HTTP_X_REAL_IP', + 'http_agent_ip' => 'HTTP_X_REAL_IP', // URL伪静态后缀 - 'url_html_suffix' => 'html', + 'url_html_suffix' => 'html', // URL普通方式参数 用于自动生成 - 'url_common_param' => false, + 'url_common_param' => false, // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, + 'url_param_type' => 0, // 是否开启路由延迟解析 - 'url_lazy_route' => false, + 'url_lazy_route' => false, // 是否强制使用路由 - 'url_route_must' => false, + 'url_route_must' => false, // 合并路由规则 - 'route_rule_merge' => false, + 'route_rule_merge' => false, // 路由是否完全匹配 - 'route_complete_match' => false, + 'route_complete_match' => false, // 使用注解路由 - 'route_annotation' => false, + 'route_annotation' => false, // 域名根,如thinkphp.cn - 'url_domain_root' => '', + 'url_domain_root' => '', // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, + 'url_convert' => true, // 默认的路由变量规则 - 'default_route_pattern' => '\w+', + 'default_route_pattern' => '\w+', // 默认的访问控制器层 - 'url_controller_layer' => 'controller', + 'url_controller_layer' => 'controller', // 表单请求类型伪装变量 - 'var_method' => '_method', + 'var_method' => '_method', // 表单ajax伪装变量 - 'var_ajax' => '_ajax', + 'var_ajax' => '_ajax', // 表单pjax伪装变量 - 'var_pjax' => '_pjax', + 'var_pjax' => '_pjax', // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, + 'request_cache' => false, // 请求缓存有效期 - 'request_cache_expire' => null, + 'request_cache_expire' => null, // 全局请求缓存排除规则 - 'request_cache_except' => [], + 'request_cache_except' => [], // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', // +---------------------------------------------------------------------- // | 异常及错误设置 // +---------------------------------------------------------------------- // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', + 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', + 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => false, + 'show_error_msg' => false, // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', + 'exception_handle' => '', ], // +---------------------------------------------------------------------- -- Gitee From 77f89545b90d454f3cb8da5a4419a5795443ab6d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 9 Jan 2019 14:34:31 +0800 Subject: [PATCH 055/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/event.php | 1 - config/app.php | 100 +++++++++++++++++++++---------------------------- convention.php | 8 ---- 3 files changed, 43 insertions(+), 66 deletions(-) diff --git a/app/event.php b/app/event.php index 10c7591..a8ee228 100644 --- a/app/event.php +++ b/app/event.php @@ -25,7 +25,6 @@ return [ 'AppEnd' => [], 'LogLevel' => [], 'LogWrite' => [], - 'ViewFilter' => [], 'ResponseSend' => [], 'ResponseEnd' => [], ], diff --git a/config/app.php b/config/app.php index afc994b..68a064b 100644 --- a/config/app.php +++ b/config/app.php @@ -16,111 +16,97 @@ use think\facade\Env; return [ // 应用名称 - 'app_name' => '', + 'app_name' => '', // 应用地址 - 'app_host' => '', + 'app_host' => '', // 应用调试模式 - 'app_debug' => false, + 'app_debug' => false, // 应用Trace - 'app_trace' => false, - // 应用根命名空间 - 'root_namespace' => 'app', - // 应用命名空间 - 'app_namespace' => '', + 'app_trace' => false, // 默认输出类型 - 'default_return_type' => 'html', + 'default_return_type' => 'html', // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', + 'default_ajax_return' => 'json', // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', + 'default_jsonp_handler' => 'jsonpReturn', // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', + 'var_jsonp_handler' => 'callback', // 默认时区 - 'default_timezone' => 'Asia/Shanghai', + 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 - 'lang_switch_on' => false, + 'lang_switch_on' => false, // 默认全局过滤方法 用逗号分隔多个 - 'default_filter' => '', + 'default_filter' => '', // 默认语言 - 'default_lang' => 'zh-cn', - // 应用类库后缀 - 'class_suffix' => false, - // 控制器类后缀 - 'controller_suffix' => false, + 'default_lang' => 'zh-cn', // 默认控制器名 - 'default_controller' => 'Index', + 'default_controller' => 'Index', // 默认操作名 - 'default_action' => 'index', + 'default_action' => 'index', // 默认验证器 - 'default_validate' => '', - // 默认的空控制器名 - 'empty_controller' => 'Error', - // 操作方法前缀 - 'use_action_prefix' => false, + 'default_validate' => '', // 操作方法后缀 - 'action_suffix' => '', - // 自动搜索控制器 - 'controller_auto_search' => false, + 'action_suffix' => '', // +---------------------------------------------------------------------- // | URL设置 // +---------------------------------------------------------------------- // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', + 'var_pathinfo' => 's', // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], + 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], // pathinfo分隔符 - 'pathinfo_depr' => '/', + 'pathinfo_depr' => '/', // HTTPS代理标识 - 'https_agent_name' => '', + 'https_agent_name' => '', // URL伪静态后缀 - 'url_html_suffix' => 'html', + 'url_html_suffix' => 'html', // URL普通方式参数 用于自动生成 - 'url_common_param' => false, + 'url_common_param' => false, // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, + 'url_param_type' => 0, // 是否开启路由延迟解析 - 'url_lazy_route' => false, + 'url_lazy_route' => false, // 是否强制使用路由 - 'url_route_must' => false, + 'url_route_must' => false, // 合并路由规则 - 'route_rule_merge' => false, + 'route_rule_merge' => false, // 路由是否完全匹配 - 'route_complete_match' => false, + 'route_complete_match' => false, // 使用注解路由 - 'route_annotation' => false, + 'route_annotation' => false, // 域名根,如thinkphp.cn - 'url_domain_root' => '', + 'url_domain_root' => '', // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, + 'url_convert' => true, // 默认的访问控制器层 - 'url_controller_layer' => 'controller', + 'url_controller_layer' => 'controller', // 表单请求类型伪装变量 - 'var_method' => '_method', + 'var_method' => '_method', // 表单ajax伪装变量 - 'var_ajax' => '_ajax', + 'var_ajax' => '_ajax', // 表单pjax伪装变量 - 'var_pjax' => '_pjax', + 'var_pjax' => '_pjax', // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, + 'request_cache' => false, // 请求缓存有效期 - 'request_cache_expire' => null, + 'request_cache_expire' => null, // 全局请求缓存排除规则 - 'request_cache_except' => [], + 'request_cache_except' => [], // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', + 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', + 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => false, + 'show_error_msg' => false, // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', + 'exception_handle' => '', ]; diff --git a/convention.php b/convention.php index 37545ad..cd99d5a 100644 --- a/convention.php +++ b/convention.php @@ -15,10 +15,6 @@ return [ 'app_debug' => false, // 应用Trace(环境变量优先) 'app_trace' => false, - // 应用根命名空间 - 'root_namespace' => 'app', - // 应用命名空间(仅在多应用架构有效 请在具体的应用配置中设置) - 'app_namespace' => '', // 默认输出类型 'default_return_type' => 'html', // 默认AJAX 数据返回格式,可选json xml ... @@ -35,16 +31,12 @@ return [ 'default_filter' => [], // 默认语言 'default_lang' => 'zh-cn', - // 应用类库后缀 - 'class_suffix' => false, // 默认控制器名 'default_controller' => 'Index', // 默认操作名 'default_action' => 'index', // 默认验证器 'default_validate' => '', - // 默认的空控制器名 - 'empty_controller' => 'Error', // +---------------------------------------------------------------------- // | URL及路由设置 -- Gitee From 3cf348da6aadc7ef27bff3ab85f863140b8bf7e0 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 20 Jan 2019 18:45:17 +0800 Subject: [PATCH 056/186] =?UTF-8?q?composer.json=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 19a757a..312d596 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ ], "require": { "php": ">=7.1.0", - "topthink/framework": "5.2.*-dev" + "topthink/framework": "5.2.*-dev", + "topthink/think-view":"dev-master" }, "autoload": { "psr-4": { -- Gitee From eb0ab0cc57b472a47899baced717d8854ad90ec4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 20 Jan 2019 18:54:30 +0800 Subject: [PATCH 057/186] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 312d596..62e42ad 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=7.1.0", "topthink/framework": "5.2.*-dev", - "topthink/think-view":"dev-master" + "topthink/think-view":"^1.0" }, "autoload": { "psr-4": { -- Gitee From c7317d7f6d49615f1f29d6f3dfff50dfbf70f16e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 30 Jan 2019 14:44:36 +0800 Subject: [PATCH 058/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convention.php | 89 +++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/convention.php b/convention.php index cd99d5a..8b3bd20 100644 --- a/convention.php +++ b/convention.php @@ -8,104 +8,105 @@ return [ // +---------------------------------------------------------------------- 'app' => [ // 应用名称 - 'app_name' => '', + 'app_name' => '', // 应用地址 - 'app_host' => '', + 'app_host' => '', // 应用调试模式(环境变量优先) - 'app_debug' => false, + 'app_debug' => false, // 应用Trace(环境变量优先) - 'app_trace' => false, + 'app_trace' => false, // 默认输出类型 - 'default_return_type' => 'html', + 'default_return_type' => 'html', // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', + 'default_ajax_return' => 'json', // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', + 'default_jsonp_handler' => 'jsonpReturn', // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', + 'var_jsonp_handler' => 'callback', // 默认时区 - 'default_timezone' => 'Asia/Shanghai', + 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 - 'lang_switch_on' => false, + 'lang_switch_on' => false, // 默认全局过滤方法 - 'default_filter' => [], + 'default_filter' => [], // 默认语言 - 'default_lang' => 'zh-cn', + 'default_lang' => 'zh-cn', // 默认控制器名 - 'default_controller' => 'Index', + 'default_controller' => 'Index', // 默认操作名 - 'default_action' => 'index', + 'default_action' => 'index', // 默认验证器 - 'default_validate' => '', + 'default_validate' => '', // +---------------------------------------------------------------------- // | URL及路由设置 // +---------------------------------------------------------------------- // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', + 'var_pathinfo' => 's', // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], + 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], // pathinfo分隔符 - 'pathinfo_depr' => '/', + 'pathinfo_depr' => '/', // HTTPS代理标识 - 'https_agent_name' => '', + 'https_agent_name' => '', // IP代理获取标识 - 'http_agent_ip' => 'HTTP_X_REAL_IP', + 'http_agent_ip' => 'HTTP_X_REAL_IP', // URL伪静态后缀 - 'url_html_suffix' => 'html', + 'url_html_suffix' => 'html', // URL普通方式参数 用于自动生成 - 'url_common_param' => false, + 'url_common_param' => false, // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, + 'url_param_type' => 0, // 是否开启路由延迟解析 - 'url_lazy_route' => false, + 'url_lazy_route' => false, // 是否强制使用路由 - 'url_route_must' => false, + 'url_route_must' => false, // 合并路由规则 - 'route_rule_merge' => false, + 'route_rule_merge' => false, // 路由是否完全匹配 - 'route_complete_match' => false, + 'route_complete_match' => false, // 使用注解路由 - 'route_annotation' => false, + 'route_annotation' => false, // 域名根,如thinkphp.cn - 'url_domain_root' => '', + 'url_domain_root' => '', // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, + 'url_convert' => true, // 默认的路由变量规则 - 'default_route_pattern' => '\w+', + 'default_route_pattern' => '\w+', // 默认的访问控制器层 - 'url_controller_layer' => 'controller', + 'url_controller_layer' => 'controller', // 表单请求类型伪装变量 - 'var_method' => '_method', + 'var_method' => '_method', // 表单ajax伪装变量 - 'var_ajax' => '_ajax', + 'var_ajax' => '_ajax', // 表单pjax伪装变量 - 'var_pjax' => '_pjax', + 'var_pjax' => '_pjax', // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, + 'request_cache' => false, // 请求缓存有效期 - 'request_cache_expire' => null, + 'request_cache_expire' => null, // 全局请求缓存排除规则 - 'request_cache_except' => [], + 'request_cache_except' => [], // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', // +---------------------------------------------------------------------- // | 异常及错误设置 // +---------------------------------------------------------------------- // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', + 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', + 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => false, + 'show_error_msg' => false, // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', + 'exception_handle' => '', + 'exception_response_type' => 'html', ], // +---------------------------------------------------------------------- -- Gitee From 3b9dd1c2285c44211ae6080fca05009967aa3c5d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 18 Feb 2019 15:19:33 +0800 Subject: [PATCH 059/186] =?UTF-8?q?event=E4=BA=8B=E4=BB=B6=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/event.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/event.php b/app/event.php index a8ee228..75dbe7b 100644 --- a/app/event.php +++ b/app/event.php @@ -16,12 +16,10 @@ return [ 'listen' => [ 'AppInit' => [ 'think\listener\LoadLangPack', - 'think\listener\RouteCheck', ], 'AppBegin' => [ 'think\listener\CheckRequestCache', ], - 'ActionBegin' => [], 'AppEnd' => [], 'LogLevel' => [], 'LogWrite' => [], -- Gitee From 0ff862765b3a83a8b8d5939a22fb5e3d24f73ca2 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 18 Feb 2019 16:02:36 +0800 Subject: [PATCH 060/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 94 +++++++++--------------------------------- config/route.php | 61 +++++++++++++++++++++++++++ convention.php | 105 +++++++++++++++++++++++------------------------ 3 files changed, 133 insertions(+), 127 deletions(-) create mode 100644 config/route.php diff --git a/config/app.php b/config/app.php index 68a064b..970405d 100644 --- a/config/app.php +++ b/config/app.php @@ -16,97 +16,43 @@ use think\facade\Env; return [ // 应用名称 - 'app_name' => '', + 'app_name' => '', // 应用地址 - 'app_host' => '', + 'app_host' => '', // 应用调试模式 - 'app_debug' => false, + 'app_debug' => false, // 应用Trace - 'app_trace' => false, + 'app_trace' => false, // 默认输出类型 - 'default_return_type' => 'html', + 'default_return_type' => 'html', // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', + 'default_ajax_return' => 'json', // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', + 'default_jsonp_handler' => 'jsonpReturn', // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', + 'var_jsonp_handler' => 'callback', // 默认时区 - 'default_timezone' => 'Asia/Shanghai', + 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 - 'lang_switch_on' => false, - // 默认全局过滤方法 用逗号分隔多个 - 'default_filter' => '', + 'lang_switch_on' => false, // 默认语言 - 'default_lang' => 'zh-cn', - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', + 'default_lang' => 'zh-cn', // 默认验证器 - 'default_validate' => '', - // 操作方法后缀 - 'action_suffix' => '', - - // +---------------------------------------------------------------------- - // | URL设置 - // +---------------------------------------------------------------------- - - // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', - // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], - // pathinfo分隔符 - 'pathinfo_depr' => '/', - // HTTPS代理标识 - 'https_agent_name' => '', - // URL伪静态后缀 - 'url_html_suffix' => 'html', - // URL普通方式参数 用于自动生成 - 'url_common_param' => false, - // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, - // 是否开启路由延迟解析 - 'url_lazy_route' => false, - // 是否强制使用路由 - 'url_route_must' => false, - // 合并路由规则 - 'route_rule_merge' => false, - // 路由是否完全匹配 - 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, - // 域名根,如thinkphp.cn - 'url_domain_root' => '', - // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, - // 默认的访问控制器层 - 'url_controller_layer' => 'controller', - // 表单请求类型伪装变量 - 'var_method' => '_method', - // 表单ajax伪装变量 - 'var_ajax' => '_ajax', - // 表单pjax伪装变量 - 'var_pjax' => '_pjax', - // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, - // 请求缓存有效期 - 'request_cache_expire' => null, - // 全局请求缓存排除规则 - 'request_cache_except' => [], + 'default_validate' => '', // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', + 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', + 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => false, + 'show_error_msg' => false, // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', - + 'exception_handle' => '', + // 异常响应输出类型 + 'exception_response_type' => 'html', ]; diff --git a/config/route.php b/config/route.php new file mode 100644 index 0000000..ca0831a --- /dev/null +++ b/config/route.php @@ -0,0 +1,61 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 应用设置 +// +---------------------------------------------------------------------- + +return [ + // PATHINFO变量名 用于兼容模式 + 'var_pathinfo' => 's', + // 兼容PATH_INFO获取 + 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], + // pathinfo分隔符 + 'pathinfo_depr' => '/', + // HTTPS代理标识 + 'https_agent_name' => '', + // URL伪静态后缀 + 'url_html_suffix' => 'html', + // URL普通方式参数 用于自动生成 + 'url_common_param' => false, + // 是否开启路由延迟解析 + 'url_lazy_route' => false, + // 是否强制使用路由 + 'url_route_must' => false, + // 合并路由规则 + 'route_rule_merge' => false, + // 路由是否完全匹配 + 'route_complete_match' => false, + // 使用注解路由 + 'route_annotation' => false, + // 域名根,如thinkphp.cn + 'url_domain_root' => '', + // 是否自动转换URL中的控制器和操作名 + 'url_convert' => true, + // 表单请求类型伪装变量 + 'var_method' => '_method', + // 表单ajax伪装变量 + 'var_ajax' => '_ajax', + // 表单pjax伪装变量 + 'var_pjax' => '_pjax', + // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 + 'request_cache' => false, + // 请求缓存有效期 + 'request_cache_expire' => null, + // 全局请求缓存排除规则 + 'request_cache_except' => [], + // 默认控制器名 + 'default_controller' => 'Index', + // 默认操作名 + 'default_action' => 'index', + // 操作方法后缀 + 'action_suffix' => '', +]; diff --git a/convention.php b/convention.php index 8b3bd20..6296053 100644 --- a/convention.php +++ b/convention.php @@ -27,86 +27,85 @@ return [ 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 'lang_switch_on' => false, - // 默认全局过滤方法 - 'default_filter' => [], // 默认语言 'default_lang' => 'zh-cn', - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', // 默认验证器 'default_validate' => '', + // 默认跳转页面对应的模板文件 + 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + // +---------------------------------------------------------------------- - // | URL及路由设置 + // | 异常及错误设置 // +---------------------------------------------------------------------- + // 异常页面的模板文件 + 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', + // 错误显示信息,非调试模式有效 + 'error_message' => '页面错误!请稍后再试~', + // 显示错误信息 + 'show_error_msg' => false, + // 异常处理handle类 留空使用 \think\exception\Handle + 'exception_handle' => '', + // 异常响应输出类型 + 'exception_response_type' => 'html', + ], + + // +---------------------------------------------------------------------- + // | URL及路由设置 + // +---------------------------------------------------------------------- + 'route' => [ + // HTTPS代理标识 + 'https_agent_name' => '', + // IP代理获取标识 + 'http_agent_ip' => 'HTTP_X_REAL_IP', // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', + 'var_pathinfo' => 's', // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], + 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], // pathinfo分隔符 - 'pathinfo_depr' => '/', - // HTTPS代理标识 - 'https_agent_name' => '', - // IP代理获取标识 - 'http_agent_ip' => 'HTTP_X_REAL_IP', + 'pathinfo_depr' => '/', // URL伪静态后缀 - 'url_html_suffix' => 'html', + 'url_html_suffix' => 'html', // URL普通方式参数 用于自动生成 - 'url_common_param' => false, - // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, + 'url_common_param' => false, // 是否开启路由延迟解析 - 'url_lazy_route' => false, + 'url_lazy_route' => false, // 是否强制使用路由 - 'url_route_must' => false, + 'url_route_must' => false, // 合并路由规则 - 'route_rule_merge' => false, + 'route_rule_merge' => false, // 路由是否完全匹配 - 'route_complete_match' => false, + 'route_complete_match' => false, // 使用注解路由 - 'route_annotation' => false, + 'route_annotation' => false, // 域名根,如thinkphp.cn - 'url_domain_root' => '', + 'url_domain_root' => '', // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, + 'url_convert' => true, // 默认的路由变量规则 - 'default_route_pattern' => '\w+', - // 默认的访问控制器层 - 'url_controller_layer' => 'controller', + 'default_route_pattern' => '\w+', // 表单请求类型伪装变量 - 'var_method' => '_method', + 'var_method' => '_method', // 表单ajax伪装变量 - 'var_ajax' => '_ajax', + 'var_ajax' => '_ajax', // 表单pjax伪装变量 - 'var_pjax' => '_pjax', + 'var_pjax' => '_pjax', // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, + 'request_cache' => false, // 请求缓存有效期 - 'request_cache_expire' => null, + 'request_cache_expire' => null, // 全局请求缓存排除规则 - 'request_cache_except' => [], - - // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - - // +---------------------------------------------------------------------- - // | 异常及错误设置 - // +---------------------------------------------------------------------- - - // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', - - // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', - // 显示错误信息 - 'show_error_msg' => false, - // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', - 'exception_response_type' => 'html', + 'request_cache_except' => [], + // 默认全局过滤方法 + 'default_filter' => [], + // 默认控制器名 + 'default_controller' => 'Index', + // 默认操作名 + 'default_action' => 'index', + // 操作方法后缀 + 'action_suffix' => '', ], // +---------------------------------------------------------------------- -- Gitee From 456120bc51be0491bb9b6b61825e1b25f80b6e44 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 18 Feb 2019 19:11:55 +0800 Subject: [PATCH 061/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 8 -------- config/route.php | 52 ++++++++++++++++++++++++++++-------------------- convention.php | 16 +++++++-------- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/config/app.php b/config/app.php index 970405d..257628f 100644 --- a/config/app.php +++ b/config/app.php @@ -23,14 +23,6 @@ return [ 'app_debug' => false, // 应用Trace 'app_trace' => false, - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', - // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', - // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', // 默认时区 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 diff --git a/config/route.php b/config/route.php index ca0831a..d429443 100644 --- a/config/route.php +++ b/config/route.php @@ -15,47 +15,55 @@ return [ // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', + 'var_pathinfo' => 's', // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], + 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], // pathinfo分隔符 - 'pathinfo_depr' => '/', + 'pathinfo_depr' => '/', // HTTPS代理标识 - 'https_agent_name' => '', + 'https_agent_name' => '', // URL伪静态后缀 - 'url_html_suffix' => 'html', + 'url_html_suffix' => 'html', // URL普通方式参数 用于自动生成 - 'url_common_param' => false, + 'url_common_param' => false, // 是否开启路由延迟解析 - 'url_lazy_route' => false, + 'url_lazy_route' => false, // 是否强制使用路由 - 'url_route_must' => false, + 'url_route_must' => false, // 合并路由规则 - 'route_rule_merge' => false, + 'route_rule_merge' => false, // 路由是否完全匹配 - 'route_complete_match' => false, + 'route_complete_match' => false, // 使用注解路由 - 'route_annotation' => false, + 'route_annotation' => false, // 域名根,如thinkphp.cn - 'url_domain_root' => '', + 'url_domain_root' => '', // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, + 'url_convert' => true, // 表单请求类型伪装变量 - 'var_method' => '_method', + 'var_method' => '_method', // 表单ajax伪装变量 - 'var_ajax' => '_ajax', + 'var_ajax' => '_ajax', // 表单pjax伪装变量 - 'var_pjax' => '_pjax', + 'var_pjax' => '_pjax', // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, + 'request_cache' => false, // 请求缓存有效期 - 'request_cache_expire' => null, + 'request_cache_expire' => null, // 全局请求缓存排除规则 - 'request_cache_except' => [], + 'request_cache_except' => [], // 默认控制器名 - 'default_controller' => 'Index', + 'default_controller' => 'Index', // 默认操作名 - 'default_action' => 'index', + 'default_action' => 'index', // 操作方法后缀 - 'action_suffix' => '', + 'action_suffix' => '', + // 默认输出类型 + 'default_return_type' => 'html', + // 默认AJAX 数据返回格式,可选json xml ... + 'default_ajax_return' => 'json', + // 默认JSONP格式返回的处理方法 + 'default_jsonp_handler' => 'jsonpReturn', + // 默认JSONP处理方法 + 'var_jsonp_handler' => 'callback', ]; diff --git a/convention.php b/convention.php index 6296053..e6476b3 100644 --- a/convention.php +++ b/convention.php @@ -15,14 +15,6 @@ return [ 'app_debug' => false, // 应用Trace(环境变量优先) 'app_trace' => false, - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', - // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', - // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', // 默认时区 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 @@ -106,6 +98,14 @@ return [ 'default_action' => 'index', // 操作方法后缀 'action_suffix' => '', + // 默认输出类型 + 'default_return_type' => 'html', + // 默认AJAX 数据返回格式,可选json xml ... + 'default_ajax_return' => 'json', + // 默认JSONP格式返回的处理方法 + 'default_jsonp_handler' => 'jsonpReturn', + // 默认JSONP处理方法 + 'var_jsonp_handler' => 'callback', ], // +---------------------------------------------------------------------- -- Gitee From 5c9caeff9da2c935f94b683280f5272dcf73081b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 20 Feb 2019 14:33:17 +0800 Subject: [PATCH 062/186] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=83=AF=E4=BE=8B?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convention.php | 289 ------------------------------------------------- 1 file changed, 289 deletions(-) delete mode 100644 convention.php diff --git a/convention.php b/convention.php deleted file mode 100644 index e6476b3..0000000 --- a/convention.php +++ /dev/null @@ -1,289 +0,0 @@ - [ - // 应用名称 - 'app_name' => '', - // 应用地址 - 'app_host' => '', - // 应用调试模式(环境变量优先) - 'app_debug' => false, - // 应用Trace(环境变量优先) - 'app_trace' => false, - // 默认时区 - 'default_timezone' => 'Asia/Shanghai', - // 是否开启多语言 - 'lang_switch_on' => false, - // 默认语言 - 'default_lang' => 'zh-cn', - // 默认验证器 - 'default_validate' => '', - - // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - - // +---------------------------------------------------------------------- - // | 异常及错误设置 - // +---------------------------------------------------------------------- - - // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', - // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', - // 显示错误信息 - 'show_error_msg' => false, - // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', - // 异常响应输出类型 - 'exception_response_type' => 'html', - ], - - // +---------------------------------------------------------------------- - // | URL及路由设置 - // +---------------------------------------------------------------------- - 'route' => [ - // HTTPS代理标识 - 'https_agent_name' => '', - // IP代理获取标识 - 'http_agent_ip' => 'HTTP_X_REAL_IP', - // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', - // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], - // pathinfo分隔符 - 'pathinfo_depr' => '/', - // URL伪静态后缀 - 'url_html_suffix' => 'html', - // URL普通方式参数 用于自动生成 - 'url_common_param' => false, - // 是否开启路由延迟解析 - 'url_lazy_route' => false, - // 是否强制使用路由 - 'url_route_must' => false, - // 合并路由规则 - 'route_rule_merge' => false, - // 路由是否完全匹配 - 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, - // 域名根,如thinkphp.cn - 'url_domain_root' => '', - // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, - // 默认的路由变量规则 - 'default_route_pattern' => '\w+', - // 表单请求类型伪装变量 - 'var_method' => '_method', - // 表单ajax伪装变量 - 'var_ajax' => '_ajax', - // 表单pjax伪装变量 - 'var_pjax' => '_pjax', - // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, - // 请求缓存有效期 - 'request_cache_expire' => null, - // 全局请求缓存排除规则 - 'request_cache_except' => [], - // 默认全局过滤方法 - 'default_filter' => [], - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', - // 操作方法后缀 - 'action_suffix' => '', - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', - // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', - // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', - ], - - // +---------------------------------------------------------------------- - // | 模板设置 - // +---------------------------------------------------------------------- - - 'template' => [ - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 - 'auto_rule' => 1, - // 模板引擎类型 支持 php think 支持扩展 - 'type' => 'Think', - // 视图基础目录,配置目录为所有模块的视图起始目录 - 'view_base' => '', - // 当前模板的视图目录 留空为自动获取 - 'view_path' => '', - // 模板后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', - // 模板引擎普通标签结束标记 - 'tpl_end' => '}', - // 标签库标签开始标记 - 'taglib_begin' => '{', - // 标签库标签结束标记 - 'taglib_end' => '}', - ], - - // +---------------------------------------------------------------------- - // | 日志设置 - // +---------------------------------------------------------------------- - - 'log' => [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - - // 日志记录级别 - 'level' => [], - // 是否记录trace信息到日志 - 'record_trace' => false, - - // 以下配置仅对文件方式日志有效 - // 是否为单日志文件 - 'single' => false, - // 日志文件最大限制 - 'file_size' => 2097152, - // 日志目录 - 'path' => '', - // 独立日志文件类型 - 'apart_level' => [], - // 最大日志数量 - 'max_files' => 0, - // 是否JSON格式记录 - 'json' => false, - ], - - // +---------------------------------------------------------------------- - // | Trace设置 开启 app_trace 后 有效 - // +---------------------------------------------------------------------- - 'trace' => [ - // 内置Html Console 支持扩展 - 'type' => 'Html', - 'file' => Env::get('think_path') . 'tpl/page_trace.tpl', - ], - - // +---------------------------------------------------------------------- - // | 缓存设置 - // +---------------------------------------------------------------------- - - 'cache' => [ - // 驱动方式 - 'type' => 'File', - // 缓存保存目录 - //'path' => CACHE_PATH, - // 缓存前缀 - 'prefix' => '', - // 缓存有效期 0表示永久缓存 - 'expire' => 0, - ], - - // +---------------------------------------------------------------------- - // | 会话设置 - // +---------------------------------------------------------------------- - - 'session' => [ - 'id' => '', - // SESSION_ID的提交变量,解决flash上传跨域 - 'var_session_id' => '', - // 驱动方式 支持redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, - // Session配置参数 - 'options' => [ - ], - ], - - // +---------------------------------------------------------------------- - // | Cookie设置 - // +---------------------------------------------------------------------- - 'cookie' => [ - // cookie 名称前缀 - 'prefix' => '', - // cookie 保存时间 - 'expire' => 0, - // cookie 保存路径 - 'path' => '/', - // cookie 有效域名 - 'domain' => '', - // cookie 启用安全传输 - 'secure' => false, - // httponly设置 - 'httponly' => '', - // 是否使用 setcookie - 'setcookie' => true, - ], - - // +---------------------------------------------------------------------- - // | 数据库设置 - // +---------------------------------------------------------------------- - - 'database' => [ - // 数据库类型 - 'type' => 'mysql', - // 数据库连接DSN配置 - 'dsn' => '', - // 服务器地址 - 'hostname' => '127.0.0.1', - // 数据库名 - 'database' => '', - // 数据库用户名 - 'username' => 'root', - // 数据库密码 - 'password' => '', - // 数据库连接端口 - 'hostport' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '', - // 数据库调试模式 - 'debug' => false, - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 数据集返回类型 - 'resultset_type' => 'array', - // 自动写入时间戳字段 - 'auto_timestamp' => false, - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', - // 是否需要进行SQL性能分析 - 'sql_explain' => false, - // 查询对象 - 'query' => '\\think\\db\\Query', - ], - - //分页配置 - 'paginate' => [ - 'type' => 'bootstrap', - 'var_page' => 'page', - 'list_rows' => 15, - ], - - //控制台配置 - 'console' => [ - 'name' => 'Think Console', - 'version' => '0.1', - 'user' => null, - ], -]; -- Gitee From 46f62af331a3350b8044bc88101e4672d36f370e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 20 Feb 2019 15:46:57 +0800 Subject: [PATCH 063/186] =?UTF-8?q?=E5=88=A0=E9=99=A4template=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/template.php | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 config/template.php diff --git a/config/template.php b/config/template.php deleted file mode 100644 index 299bd6f..0000000 --- a/config/template.php +++ /dev/null @@ -1,35 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 模板设置 -// +---------------------------------------------------------------------- - -return [ - // 模板引擎类型 支持 php think 支持扩展 - 'type' => 'Think', - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 模板路径 - 'view_path' => '', - // 模板后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', - // 模板引擎普通标签结束标记 - 'tpl_end' => '}', - // 标签库标签开始标记 - 'taglib_begin' => '{', - // 标签库标签结束标记 - 'taglib_end' => '}', -]; -- Gitee From cc1137f7572a62370b880a680fe4333557862200 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 8 Mar 2019 17:22:25 +0800 Subject: [PATCH 064/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E5=A2=9E=E5=8A=A0initialize=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=89=A7=E8=A1=8C=20run=E6=96=B9=E6=B3=95=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E8=87=AA=E5=8A=A8=E6=89=A7=E8=A1=8Cinitialize?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index c928505..fc0144d 100644 --- a/public/index.php +++ b/public/index.php @@ -15,4 +15,6 @@ namespace think; require __DIR__ . '/../vendor/autoload.php'; // 执行应用并响应 -(new App())->run()->send(); +(new App())->initialize() + ->run() + ->send(); -- Gitee From da8cda8f8ed276e9ce80335a0f2e9ac9f59d4a1e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 12 Mar 2019 16:13:29 +0800 Subject: [PATCH 065/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E4=BE=9D=E8=B5=96=E5=BA=93=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 ++- public/index.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 62e42ad..91ae4ea 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "require": { "php": ">=7.1.0", "topthink/framework": "5.2.*-dev", - "topthink/think-view":"^1.0" + "topthink/think-view":"^1.0", + "topthink/think-template":"^2.0" }, "autoload": { "psr-4": { diff --git a/public/index.php b/public/index.php index fc0144d..0d3dda8 100644 --- a/public/index.php +++ b/public/index.php @@ -15,6 +15,6 @@ namespace think; require __DIR__ . '/../vendor/autoload.php'; // 执行应用并响应 -(new App())->initialize() +(new Web())->initialize() ->run() ->send(); -- Gitee From 0e11052aebab65fadb0c1be40b75d90c541d8ce4 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Tue, 12 Mar 2019 18:02:21 +0800 Subject: [PATCH 066/186] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command.php | 12 ------------ composer.json | 8 ++++---- config/app.php | 8 +++----- config/console.php | 5 ++--- public/index.php | 8 +++++--- think | 7 ++++--- 6 files changed, 18 insertions(+), 30 deletions(-) delete mode 100644 app/command.php diff --git a/app/command.php b/app/command.php deleted file mode 100644 index 826bb2b..0000000 --- a/app/command.php +++ /dev/null @@ -1,12 +0,0 @@ - -// +---------------------------------------------------------------------- - -return []; diff --git a/composer.json b/composer.json index 91ae4ea..fd746d2 100644 --- a/composer.json +++ b/composer.json @@ -18,16 +18,16 @@ "require": { "php": ">=7.1.0", "topthink/framework": "5.2.*-dev", - "topthink/think-view":"^1.0", - "topthink/think-template":"^2.0" + "topthink/think-view": "^1.0", + "topthink/think-template": "^2.0" }, "autoload": { "psr-4": { "app\\": "app" }, - "psr-0":{ + "psr-0": { "": "extend/" - } + } }, "config": { "preferred-install": "dist" diff --git a/config/app.php b/config/app.php index 257628f..a6582c0 100644 --- a/config/app.php +++ b/config/app.php @@ -33,18 +33,16 @@ return [ 'default_validate' => '', // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_success_tmpl' => app()->getThinkPath() . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => app()->getThinkPath() . 'tpl/dispatch_jump.tpl', // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', + 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', // 错误显示信息,非调试模式有效 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 'show_error_msg' => false, - // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', // 异常响应输出类型 'exception_response_type' => 'html', ]; diff --git a/config/console.php b/config/console.php index b0f9165..7ed10c6 100644 --- a/config/console.php +++ b/config/console.php @@ -13,7 +13,6 @@ // | 控制台配置 // +---------------------------------------------------------------------- return [ - 'name' => 'Think Console', - 'version' => '0.1', - 'user' => null, + 'user' => null, + 'commands' => [] ]; diff --git a/public/index.php b/public/index.php index 0d3dda8..16371fa 100644 --- a/public/index.php +++ b/public/index.php @@ -15,6 +15,8 @@ namespace think; require __DIR__ . '/../vendor/autoload.php'; // 执行应用并响应 -(new Web())->initialize() - ->run() - ->send(); +$app = (new App())->initialize(); + +/** @var Web $web */ +$web = $app->make(Web::class); +$web->controllerSuffix()->run()->send(); diff --git a/think b/think index 0d0e28b..f6a338c 100644 --- a/think +++ b/think @@ -16,7 +16,8 @@ namespace think; require __DIR__ . '/vendor/autoload.php'; // 应用初始化 -(new App())->multi(false)->initialize(); +$app = (new App())->initialize(); -// 控制台初始化 -Console::init(); \ No newline at end of file +/** @var Console $console */ +$console = $app->make(Console::class); +$console->run(); \ No newline at end of file -- Gitee From 2a024dfb5ee09fda1e4377cb59d7ba87439770ed Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Tue, 12 Mar 2019 18:04:56 +0800 Subject: [PATCH 067/186] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index 16371fa..7add22f 100644 --- a/public/index.php +++ b/public/index.php @@ -19,4 +19,4 @@ $app = (new App())->initialize(); /** @var Web $web */ $web = $app->make(Web::class); -$web->controllerSuffix()->run()->send(); +$web->run()->send(); -- Gitee From 8479ba821a0078a42ba6d76c8c1885489f176206 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Wed, 13 Mar 2019 16:26:28 +0800 Subject: [PATCH 068/186] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 5 +++++ public/index.php | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index fd746d2..85dcdea 100644 --- a/composer.json +++ b/composer.json @@ -31,5 +31,10 @@ }, "config": { "preferred-install": "dist" + }, + "scripts": { + "post-autoload-dump": [ + "@php think service:discover" + ] } } diff --git a/public/index.php b/public/index.php index 7add22f..c89ee7d 100644 --- a/public/index.php +++ b/public/index.php @@ -17,6 +17,6 @@ require __DIR__ . '/../vendor/autoload.php'; // 执行应用并响应 $app = (new App())->initialize(); -/** @var Web $web */ -$web = $app->make(Web::class); -$web->run()->send(); +/** @var Http $http */ +$http = $app->make(Http::class); +$http->run()->send(); -- Gitee From f1ebd646eda1cbd7ccb33fa543374ec08b7bd44c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 16 Mar 2019 21:39:01 +0800 Subject: [PATCH 069/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=AE=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 1 - public/index.php | 8 ++------ think | 6 +----- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/config/app.php b/config/app.php index a6582c0..73617cd 100644 --- a/config/app.php +++ b/config/app.php @@ -8,7 +8,6 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- -use think\facade\Env; // +---------------------------------------------------------------------- // | 应用设置 diff --git a/public/index.php b/public/index.php index c89ee7d..d9f64c3 100644 --- a/public/index.php +++ b/public/index.php @@ -14,9 +14,5 @@ namespace think; require __DIR__ . '/../vendor/autoload.php'; -// 执行应用并响应 -$app = (new App())->initialize(); - -/** @var Http $http */ -$http = $app->make(Http::class); -$http->run()->send(); +// 执行HTTP应用并响应 +(new App())->http->run()->send(); diff --git a/think b/think index f6a338c..b7e9aa4 100644 --- a/think +++ b/think @@ -16,8 +16,4 @@ namespace think; require __DIR__ . '/vendor/autoload.php'; // 应用初始化 -$app = (new App())->initialize(); - -/** @var Console $console */ -$console = $app->make(Console::class); -$console->run(); \ No newline at end of file +(new App())->console->run(); \ No newline at end of file -- Gitee From 031bfa6f483dfb78a53b350e8c908c179b756844 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 16 Mar 2019 22:18:59 +0800 Subject: [PATCH 070/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/console.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/console.php b/config/console.php index 7ed10c6..cf6b4ec 100644 --- a/config/console.php +++ b/config/console.php @@ -13,6 +13,9 @@ // | 控制台配置 // +---------------------------------------------------------------------- return [ + // 执行用户(Windows下无效) 'user' => null, - 'commands' => [] + // 指令定义 + 'commands' => [ + ], ]; -- Gitee From ddabfb20ee67370bd8ea67d32f7f17c798c1f9ae Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 19 Mar 2019 16:21:41 +0800 Subject: [PATCH 071/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/route.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/route.php b/config/route.php index d429443..c351e42 100644 --- a/config/route.php +++ b/config/route.php @@ -36,6 +36,8 @@ return [ 'route_complete_match' => false, // 使用注解路由 'route_annotation' => false, + // 默认的路由变量规则 + 'default_route_pattern' => '[\w\.]+', // 域名根,如thinkphp.cn 'url_domain_root' => '', // 是否自动转换URL中的控制器和操作名 -- Gitee From d4fdfd548604585fb2441491f46ac37b6780e2a0 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 20 Mar 2019 11:51:57 +0800 Subject: [PATCH 072/186] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 +-- config/route.php | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 85dcdea..a9c88ee 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,7 @@ "require": { "php": ">=7.1.0", "topthink/framework": "5.2.*-dev", - "topthink/think-view": "^1.0", - "topthink/think-template": "^2.0" + "topthink/think-view": "^1.0" }, "autoload": { "psr-4": { diff --git a/config/route.php b/config/route.php index c351e42..8542cc1 100644 --- a/config/route.php +++ b/config/route.php @@ -60,10 +60,6 @@ return [ 'default_action' => 'index', // 操作方法后缀 'action_suffix' => '', - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', // 默认JSONP格式返回的处理方法 'default_jsonp_handler' => 'jsonpReturn', // 默认JSONP处理方法 -- Gitee From f8b3621e9f256fa73785b62938c34ec03ba44c48 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Thu, 21 Mar 2019 15:50:34 +0800 Subject: [PATCH 073/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E6=8C=87=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a9c88ee..fff3cb7 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ }, "scripts": { "post-autoload-dump": [ - "@php think service:discover" + "@php think service:discover", + "@php think vendor:publish" ] } } -- Gitee From c6625b5db6512e201e7bb6a455bdad59212d278f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 21 Mar 2019 23:19:50 +0800 Subject: [PATCH 074/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 14 ++++++++++---- config/route.php | 12 ++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/config/app.php b/config/app.php index 73617cd..2f2ba54 100644 --- a/config/app.php +++ b/config/app.php @@ -14,14 +14,20 @@ // +---------------------------------------------------------------------- return [ - // 应用名称 - 'app_name' => '', // 应用地址 'app_host' => '', - // 应用调试模式 - 'app_debug' => false, // 应用Trace 'app_trace' => false, + // 是否启用路由 + 'with_route' => true, + // 自动多应用模式 + 'auto_multi_app' => false, + // 应用映射 + 'app_map' => [], + // 域名绑定 + 'domain_bind' => [], + // 默认应用 + 'default_app' => 'index', // 默认时区 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 diff --git a/config/route.php b/config/route.php index 8542cc1..4ef85d3 100644 --- a/config/route.php +++ b/config/route.php @@ -36,6 +36,18 @@ return [ 'route_complete_match' => false, // 使用注解路由 'route_annotation' => false, + // 是否开启路由缓存 + 'route_check_cache' => false, + // 路由缓存连接参数 + 'route_cache_option' => [], + // 路由缓存Key + 'route_check_cache_key' => '', + // 访问控制器层名称 + 'controller_layer' => 'controller', + // 空控制器名 + 'empty_controller' => 'Error', + // 是否使用控制器后缀 + 'controller_suffix' => false, // 默认的路由变量规则 'default_route_pattern' => '[\w\.]+', // 域名根,如thinkphp.cn -- Gitee From 2dbac29577a969b44b7ecbd35d5852f4f91b3243 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 22 Mar 2019 12:32:26 +0800 Subject: [PATCH 075/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/app.php b/config/app.php index 2f2ba54..221347e 100644 --- a/config/app.php +++ b/config/app.php @@ -18,6 +18,8 @@ return [ 'app_host' => '', // 应用Trace 'app_trace' => false, + // 应用的命名空间 + 'app_namespace' => '', // 是否启用路由 'with_route' => true, // 自动多应用模式 -- Gitee From f3cde4c81e92abff30863b48d1c9fde93c69d3f8 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 22 Mar 2019 16:49:44 +0800 Subject: [PATCH 076/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/config/app.php b/config/app.php index 221347e..d09fd2f 100644 --- a/config/app.php +++ b/config/app.php @@ -15,41 +15,41 @@ return [ // 应用地址 - 'app_host' => '', - // 应用Trace - 'app_trace' => false, + 'app_host' => '', + // 应用Trace(环境变量优先读取) + 'app_trace' => false, // 应用的命名空间 - 'app_namespace' => '', + 'app_namespace' => '', // 是否启用路由 - 'with_route' => true, + 'with_route' => true, + // 是否启用事件 + 'with_event' => true, // 自动多应用模式 - 'auto_multi_app' => false, - // 应用映射 - 'app_map' => [], - // 域名绑定 - 'domain_bind' => [], + 'auto_multi_app' => false, + // 应用映射(自动多应用模式有效) + 'app_map' => [], + // 域名绑定(自动多应用模式有效) + 'domain_bind' => [], // 默认应用 - 'default_app' => 'index', + 'default_app' => 'index', // 默认时区 - 'default_timezone' => 'Asia/Shanghai', + 'default_timezone' => 'Asia/Shanghai', // 是否开启多语言 - 'lang_switch_on' => false, + 'lang_switch_on' => false, // 默认语言 - 'default_lang' => 'zh-cn', + 'default_lang' => 'zh-cn', // 默认验证器 - 'default_validate' => '', + 'default_validate' => '', // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => app()->getThinkPath() . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => app()->getThinkPath() . 'tpl/dispatch_jump.tpl', + 'dispatch_success_tmpl' => app()->getThinkPath() . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => app()->getThinkPath() . 'tpl/dispatch_jump.tpl', // 异常页面的模板文件 - 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', + 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', + 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => false, - // 异常响应输出类型 - 'exception_response_type' => 'html', + 'show_error_msg' => false, ]; -- Gitee From 06f976ef00e0905583531c7d6c829d11ac48192c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 23 Mar 2019 22:37:55 +0800 Subject: [PATCH 077/186] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=B8=BA6.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++----- composer.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0b8f573..b540dd7 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -ThinkPHP 5.2 +ThinkPHP 6.0 =============== -> ThinkPHP5.2的运行环境要求PHP7.1+。 +> 运行环境要求PHP7.1+。 ## 安装 ~~~ -composer create-project topthink/think tp5 5.2.*-dev +composer create-project topthink/think tp 6.0.*-dev ~~~ 如果需要更新框架使用 @@ -17,7 +17,7 @@ composer update topthink/framework ## 参与开发 -请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)。 +请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。 ## 版权信息 @@ -25,7 +25,7 @@ ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 本项目包含的第三方源码和二进制文件之版权信息另行标注。 -版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn) +版权所有Copyright © 2006-2019 by ThinkPHP (http://thinkphp.cn) All rights reserved。 diff --git a/composer.json b/composer.json index fff3cb7..05b4556 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=7.1.0", - "topthink/framework": "5.2.*-dev", + "topthink/framework": "6.0.*-dev", "topthink/think-view": "^1.0" }, "autoload": { -- Gitee From dce3ced4b5e467a58fe711338851a5fd29323798 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 24 Mar 2019 13:12:42 +0800 Subject: [PATCH 078/186] =?UTF-8?q?=E6=AC=A2=E8=BF=8E=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controller/Index.php b/app/controller/Index.php index 4e28fc9..bff26d6 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -5,10 +5,10 @@ class Index { public function index() { - return '

:)

ThinkPHP V5.2
12载初心不改 - 你值得信赖的PHP框架

'; + return '

:)

ThinkPHP V6
13载初心不改 - 你值得信赖的PHP框架

'; } - public function hello($name = 'ThinkPHP5') + public function hello($name = 'ThinkPHP6') { return 'hello,' . $name; } -- Gitee From d6301e01f218afd04f58096fc2a05cd6e17a7222 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 27 Mar 2019 11:34:08 +0800 Subject: [PATCH 079/186] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=86=85=E7=BD=AE?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/event.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/event.php b/app/event.php index 75dbe7b..df6d009 100644 --- a/app/event.php +++ b/app/event.php @@ -15,10 +15,10 @@ return [ ], 'listen' => [ 'AppInit' => [ - 'think\listener\LoadLangPack', + // 'think\listener\LoadLangPack', ], 'AppBegin' => [ - 'think\listener\CheckRequestCache', + //'think\listener\CheckRequestCache', ], 'AppEnd' => [], 'LogLevel' => [], -- Gitee From 4afbd114070f41e4aae9ef36173cac88be0ce4da Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Wed, 27 Mar 2019 12:11:01 +0800 Subject: [PATCH 080/186] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/event.php | 8 ++------ app/middleware.php | 6 ++++++ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 app/middleware.php diff --git a/app/event.php b/app/event.php index df6d009..c3918f2 100644 --- a/app/event.php +++ b/app/event.php @@ -14,12 +14,8 @@ return [ 'bind' => [ ], 'listen' => [ - 'AppInit' => [ - // 'think\listener\LoadLangPack', - ], - 'AppBegin' => [ - //'think\listener\CheckRequestCache', - ], + 'AppInit' => [], + 'AppBegin' => [], 'AppEnd' => [], 'LogLevel' => [], 'LogWrite' => [], diff --git a/app/middleware.php b/app/middleware.php new file mode 100644 index 0000000..17d8e15 --- /dev/null +++ b/app/middleware.php @@ -0,0 +1,6 @@ + Date: Wed, 27 Mar 2019 04:11:18 +0000 Subject: [PATCH 081/186] Apply fixes from StyleCI --- app/middleware.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/middleware.php b/app/middleware.php index 17d8e15..af9465d 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -3,4 +3,4 @@ return [ 'think\middleware\CheckRequestCache', 'think\middleware\LoadLangPack', -]; \ No newline at end of file +]; -- Gitee From e8543de7f07bc8314dde9622cfee8e33b0e90d02 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 27 Mar 2019 15:49:51 +0800 Subject: [PATCH 082/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index d9f64c3..e67b8d6 100644 --- a/public/index.php +++ b/public/index.php @@ -15,4 +15,10 @@ namespace think; require __DIR__ . '/../vendor/autoload.php'; // 执行HTTP应用并响应 -(new App())->http->run()->send(); +$http = (new App())->http; + +$response = $http->run(); + +$response->send(); + +$http->end($response); -- Gitee From 3e081b5621fabcb400a44204ae19d3e3d1a45b11 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 28 Mar 2019 11:55:40 +0800 Subject: [PATCH 083/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Session=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E4=B8=AD=E9=97=B4=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/middleware.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/middleware.php b/app/middleware.php index af9465d..cb167ef 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -3,4 +3,5 @@ return [ 'think\middleware\CheckRequestCache', 'think\middleware\LoadLangPack', + 'think\middleware\SessionInit', ]; -- Gitee From 1592c3c4f2162b25cf9682297d3feca88696c009 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 28 Mar 2019 14:48:05 +0800 Subject: [PATCH 084/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A1=B5=E9=9D=A2tra?= =?UTF-8?q?ce=E4=B8=AD=E9=97=B4=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/middleware.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/middleware.php b/app/middleware.php index cb167ef..4b351a2 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -4,4 +4,5 @@ return [ 'think\middleware\CheckRequestCache', 'think\middleware\LoadLangPack', 'think\middleware\SessionInit', + 'think\middleware\TraceDebug', ]; -- Gitee From 5b7915ecd627c7efb8af5a0c20d382c732adda9c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 30 Mar 2019 14:55:06 +0800 Subject: [PATCH 085/186] =?UTF-8?q?=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/public/index.php b/public/index.php index e67b8d6..d9f64c3 100644 --- a/public/index.php +++ b/public/index.php @@ -15,10 +15,4 @@ namespace think; require __DIR__ . '/../vendor/autoload.php'; // 执行HTTP应用并响应 -$http = (new App())->http; - -$response = $http->run(); - -$response->send(); - -$http->end($response); +(new App())->http->run()->send(); -- Gitee From 9ea8d9fd39a1aac440fd355cf8b4361130267bce Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 30 Mar 2019 19:53:43 +0800 Subject: [PATCH 086/186] =?UTF-8?q?Revert=20"=E5=85=A5=E5=8F=A3=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=94=B9=E8=BF=9B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index d9f64c3..e67b8d6 100644 --- a/public/index.php +++ b/public/index.php @@ -15,4 +15,10 @@ namespace think; require __DIR__ . '/../vendor/autoload.php'; // 执行HTTP应用并响应 -(new App())->http->run()->send(); +$http = (new App())->http; + +$response = $http->run(); + +$response->send(); + +$http->end($response); -- Gitee From 3ffcc8d19551ac7fea6d835b3f314b12dc68f735 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 17 Apr 2019 12:11:32 +0800 Subject: [PATCH 087/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0lang=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 4 ---- config/lang.php | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 config/lang.php diff --git a/config/app.php b/config/app.php index d09fd2f..f2b2484 100644 --- a/config/app.php +++ b/config/app.php @@ -34,10 +34,6 @@ return [ 'default_app' => 'index', // 默认时区 'default_timezone' => 'Asia/Shanghai', - // 是否开启多语言 - 'lang_switch_on' => false, - // 默认语言 - 'default_lang' => 'zh-cn', // 默认验证器 'default_validate' => '', diff --git a/config/lang.php b/config/lang.php new file mode 100644 index 0000000..b680347 --- /dev/null +++ b/config/lang.php @@ -0,0 +1,35 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 多语言设置 +// +---------------------------------------------------------------------- + +return [ + // 默认语言 + 'default_lang' => 'zh-cn', + // 允许的语言列表 + 'allow_lang_list' => [], + // 是否开启自动侦测 + 'auto_detect' => false, + // 多语言自动侦测变量名 + 'detect_var' => 'lang', + // 是否使用Cookie记录 + 'use_cookie' => true, + // 多语言cookie变量 + 'cookie_var' => 'think_lang', + // 扩展语言包 + 'extend_list' => [], + // Accept-Language转义为对应语言包名称 + 'accept_language' => [ + 'zh-hans-cn' => 'zh-cn', + ], +]; -- Gitee From 9f03c71b5b1e44ec7a924860e237654cd5f4f097 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 17 Apr 2019 18:26:27 +0800 Subject: [PATCH 088/186] =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/route.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/route.php b/config/route.php index 4ef85d3..16cda60 100644 --- a/config/route.php +++ b/config/route.php @@ -25,7 +25,7 @@ return [ // URL伪静态后缀 'url_html_suffix' => 'html', // URL普通方式参数 用于自动生成 - 'url_common_param' => false, + 'url_common_param' => true, // 是否开启路由延迟解析 'url_lazy_route' => false, // 是否强制使用路由 -- Gitee From bc62567ce97c9635fbc8bd2ee7b79ecbf1ba998a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 19 Apr 2019 12:49:10 +0800 Subject: [PATCH 089/186] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/event.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/event.php b/app/event.php index c3918f2..26ba7eb 100644 --- a/app/event.php +++ b/app/event.php @@ -13,15 +13,15 @@ return [ 'bind' => [ ], + 'listen' => [ - 'AppInit' => [], - 'AppBegin' => [], - 'AppEnd' => [], - 'LogLevel' => [], - 'LogWrite' => [], - 'ResponseSend' => [], - 'ResponseEnd' => [], + 'AppInit' => [], + 'HttpRun' => [], + 'HttpEnd' => [], + 'LogLevel' => [], + 'LogWrite' => [], ], + 'subscribe' => [ ], ]; -- Gitee From 5129d21aca2bd3edb572bdc8a8b441a85be14678 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 23 Apr 2019 16:46:12 +0800 Subject: [PATCH 090/186] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/route/app.php b/route/app.php index 25cb2bd..d8e09e3 100644 --- a/route/app.php +++ b/route/app.php @@ -11,7 +11,7 @@ use think\facade\Route; Route::get('think', function () { - return 'hello,ThinkPHP5!'; + return 'hello,ThinkPHP6!'; }); Route::get('hello/:name', 'index/hello'); -- Gitee From 598f35c1f10bdefa88001f568a696a126b921a33 Mon Sep 17 00:00:00 2001 From: chentaotao Date: Tue, 23 Apr 2019 15:44:34 +0800 Subject: [PATCH 091/186] =?UTF-8?q?=E5=B8=B8=E7=94=A8=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=20.env=20=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .example.env | 1 + config/app.php | 4 +++- config/cookie.php | 4 +++- config/database.php | 20 +++++++++++--------- config/lang.php | 4 +++- 5 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 .example.env diff --git a/.example.env b/.example.env new file mode 100644 index 0000000..4bc3932 --- /dev/null +++ b/.example.env @@ -0,0 +1 @@ +APP_DEBUG = true APP_TRACE = false [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = test USERNAME = username PASSWORD = password HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn \ No newline at end of file diff --git a/config/app.php b/config/app.php index f2b2484..ae3e1cd 100644 --- a/config/app.php +++ b/config/app.php @@ -13,9 +13,11 @@ // | 应用设置 // +---------------------------------------------------------------------- +use think\facade\Env; + return [ // 应用地址 - 'app_host' => '', + 'app_host' => Env::get('app.host', ''), // 应用Trace(环境变量优先读取) 'app_trace' => false, // 应用的命名空间 diff --git a/config/cookie.php b/config/cookie.php index 95bff33..7bd379e 100644 --- a/config/cookie.php +++ b/config/cookie.php @@ -12,9 +12,11 @@ // +---------------------------------------------------------------------- // | Cookie设置 // +---------------------------------------------------------------------- +use think\facade\Env; + return [ // cookie 名称前缀 - 'prefix' => '', + 'prefix' => Env::get('cookie.prefix', ''), // cookie 保存时间 'expire' => 0, // cookie 保存路径 diff --git a/config/database.php b/config/database.php index a0196db..15de68a 100644 --- a/config/database.php +++ b/config/database.php @@ -9,29 +9,31 @@ // | Author: liu21st // +---------------------------------------------------------------------- +use think\facade\Env; + return [ // 数据库类型 - 'type' => 'mysql', + 'type' => Env::get('database.type', 'mysql'), // 服务器地址 - 'hostname' => '127.0.0.1', + 'hostname' => Env::get('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => '', + 'database' => Env::get('database.hostname', ''), // 用户名 - 'username' => 'root', + 'username' => Env::get('database.username', 'root'), // 密码 - 'password' => '', + 'password' => Env::get('database.password', ''), // 端口 - 'hostport' => '', + 'hostport' => Env::get('database.hostport', '3306'), // 连接dsn 'dsn' => '', // 数据库连接参数 'params' => [], // 数据库编码默认采用utf8 - 'charset' => 'utf8', + 'charset' => Env::get('database.charset', 'utf8'), // 数据库表前缀 - 'prefix' => '', + 'prefix' => Env::get('database.prefix', ''), // 数据库调试模式 - 'debug' => true, + 'debug' => Env::get('database.debug', true), // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 'deploy' => 0, // 数据库读写是否分离 主从式有效 diff --git a/config/lang.php b/config/lang.php index b680347..c0c3e65 100644 --- a/config/lang.php +++ b/config/lang.php @@ -13,9 +13,11 @@ // | 多语言设置 // +---------------------------------------------------------------------- +use think\facade\Env; + return [ // 默认语言 - 'default_lang' => 'zh-cn', + 'default_lang' => Env::get('lang.default_lang', 'zh-cn'), // 允许的语言列表 'allow_lang_list' => [], // 是否开启自动侦测 -- Gitee From a99bdf8168ae098ba7660d3b0b2b330f54fbf5b2 Mon Sep 17 00:00:00 2001 From: chentaotao Date: Tue, 23 Apr 2019 16:34:03 +0800 Subject: [PATCH 092/186] =?UTF-8?q?=E5=90=8D=E7=A7=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.php b/config/database.php index 15de68a..4834854 100644 --- a/config/database.php +++ b/config/database.php @@ -17,7 +17,7 @@ return [ // 服务器地址 'hostname' => Env::get('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => Env::get('database.hostname', ''), + 'database' => Env::get('database.database', ''), // 用户名 'username' => Env::get('database.username', 'root'), // 密码 -- Gitee From f49a7235e47a4902ade791f8e0758de73e078548 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 23 Apr 2019 17:35:14 +0800 Subject: [PATCH 093/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cookie.php | 4 ---- config/session.php | 10 +++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/config/cookie.php b/config/cookie.php index 7bd379e..bbc5819 100644 --- a/config/cookie.php +++ b/config/cookie.php @@ -12,11 +12,7 @@ // +---------------------------------------------------------------------- // | Cookie设置 // +---------------------------------------------------------------------- -use think\facade\Env; - return [ - // cookie 名称前缀 - 'prefix' => Env::get('cookie.prefix', ''), // cookie 保存时间 'expire' => 0, // cookie 保存路径 diff --git a/config/session.php b/config/session.php index 38ebaf4..ae58357 100644 --- a/config/session.php +++ b/config/session.php @@ -14,14 +14,14 @@ // +---------------------------------------------------------------------- return [ - 'id' => '', + // session name + 'name' => '', // SESSION_ID的提交变量,解决flash上传跨域 'var_session_id' => '', - // 驱动方式 支持redis memcache memcached + // 驱动方式 支持file redis memcache memcached 'type' => '', // 是否自动开启 SESSION 'auto_start' => true, - // Session配置参数 - 'options' => [ - ], + // 过期时间 + 'expire' => 0, ]; -- Gitee From 59dd2bb56172759df695e3ee2390a09285e8fe70 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 25 Apr 2019 13:43:45 +0800 Subject: [PATCH 094/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/app.php b/config/app.php index ae3e1cd..018a12f 100644 --- a/config/app.php +++ b/config/app.php @@ -32,6 +32,8 @@ return [ 'app_map' => [], // 域名绑定(自动多应用模式有效) 'domain_bind' => [], + // 禁止URL访问的应用列表(自动多应用模式有效) + 'deny_app_list' => [], // 默认应用 'default_app' => 'index', // 默认时区 -- Gitee From 0d8b55546f31ddda3f62fc41ccc173af6203d222 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 28 Apr 2019 14:55:36 +0800 Subject: [PATCH 095/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0BaseController?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/BaseController.php | 279 ++++++++++++++++++++++++++++++ app/controller/Index.php | 2 +- 2 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 app/controller/BaseController.php diff --git a/app/controller/BaseController.php b/app/controller/BaseController.php new file mode 100644 index 0000000..d60b354 --- /dev/null +++ b/app/controller/BaseController.php @@ -0,0 +1,279 @@ + +// +---------------------------------------------------------------------- +declare (strict_types = 1); + +namespace think; + +use think\exception\HttpResponseException; +use think\exception\ValidateException; +use think\Response; +use think\response\Redirect; + +/** + * 控制器基础类 + */ +abstract class BaseController +{ + /** + * Request实例 + * @var \think\Request + */ + protected $request; + + /** + * 应用实例 + * @var \think\App + */ + protected $app; + + /** + * 验证失败是否抛出异常 + * @var bool + */ + protected $failException = false; + + /** + * 是否批量验证 + * @var bool + */ + protected $batchValidate = false; + + /** + * 控制器中间件 + * @var array + */ + protected $middleware = []; + + /** + * 构造方法 + * @access public + * @param App $app 应用对象 + */ + public function __construct(App $app) + { + $this->app = $app; + $this->request = $this->app->request; + + // 控制器初始化 + $this->initialize(); + $this->registerMiddleware(); + } + + // 注册控制器中间件 + private function registerMiddleware() + { + foreach ($this->middleware as $key => $val) { + if (!is_int($key)) { + if (isset($val['only']) && !in_array($this->request->action(), $val['only'])) { + continue; + } elseif (isset($val['except']) && in_array($this->request->action(), $val['except'])) { + continue; + } else { + $val = $key; + } + } + + $this->app->middleware->controller($val); + } + } + + // 初始化 + protected function initialize() + {} + + /** + * 设置验证失败后是否抛出异常 + * @access protected + * @param bool $fail 是否抛出异常 + * @return $this + */ + protected function validateFailException(bool $fail = true) + { + $this->failException = $fail; + + return $this; + } + + /** + * 验证数据 + * @access protected + * @param array $data 数据 + * @param string|array $validate 验证器名或者验证规则数组 + * @param array $message 提示信息 + * @param bool $batch 是否批量验证 + * @return array|string|true + * @throws ValidateException + */ + protected function validate(array $data, $validate, array $message = [], bool $batch = false) + { + if (is_array($validate)) { + $v = new Validate(); + $v->rule($validate); + } else { + if (strpos($validate, '.')) { + // 支持场景 + list($validate, $scene) = explode('.', $validate); + } + $class = $this->app->parseClass('validate', $validate); + $v = new $class(); + if (!empty($scene)) { + $v->scene($scene); + } + } + + $v->message($message); + + // 是否批量验证 + if ($batch || $this->batchValidate) { + $v->batch(true); + } + + if (!$v->check($data)) { + if ($this->failException) { + throw new ValidateException($v->getError()); + } + return $v->getError(); + } + + return true; + } + + /** + * 操作成功跳转的快捷方法 + * @access protected + * @param mixed $msg 提示信息 + * @param string $url 跳转的URL地址 + * @param mixed $data 返回的数据 + * @param integer $wait 跳转等待时间 + * @param array $header 发送的Header信息 + * @return void + */ + protected function success($msg = '', string $url = null, $data = '', int $wait = 3, array $header = []) + { + if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) { + $url = $_SERVER["HTTP_REFERER"]; + } elseif ($url) { + $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url); + } + + $result = [ + 'code' => 1, + 'msg' => $msg, + 'data' => $data, + 'url' => $url, + 'wait' => $wait, + ]; + + $type = $this->getResponseType(); + // 把跳转模板的渲染下沉,这样在 response_send 行为里通过getData()获得的数据是一致性的格式 + if ('html' == strtolower($type)) { + $type = 'jump'; + } + + $response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app->config->get('app.dispatch_success_tmpl')]); + + throw new HttpResponseException($response); + } + + /** + * 操作错误跳转的快捷方法 + * @access protected + * @param mixed $msg 提示信息 + * @param string $url 跳转的URL地址 + * @param mixed $data 返回的数据 + * @param integer $wait 跳转等待时间 + * @param array $header 发送的Header信息 + * @return void + */ + protected function error($msg = '', string $url = null, $data = '', int $wait = 3, array $header = []) + { + if (is_null($url)) { + $url = $this->request->isAjax() ? '' : 'javascript:history.back(-1);'; + } elseif ($url) { + $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url); + } + + $result = [ + 'code' => 0, + 'msg' => $msg, + 'data' => $data, + 'url' => $url, + 'wait' => $wait, + ]; + + $type = $this->getResponseType(); + if ('html' == strtolower($type)) { + $type = 'jump'; + } + + $response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app->config->get('app.dispatch_error_tmpl')]); + + throw new HttpResponseException($response); + } + + /** + * 返回封装后的API数据到客户端 + * @access protected + * @param mixed $data 要返回的数据 + * @param integer $code 返回的code + * @param mixed $msg 提示信息 + * @param string $type 返回数据格式 + * @param array $header 发送的Header信息 + * @return void + */ + protected function result($data, $code = 0, $msg = '', $type = '', array $header = []) + { + $result = [ + 'code' => $code, + 'msg' => $msg, + 'time' => time(), + 'data' => $data, + ]; + + $type = $type ?: $this->getResponseType(); + $response = Response::create($result, $type)->header($header); + + throw new HttpResponseException($response); + } + + /** + * URL重定向 + * @access protected + * @param string $url 跳转的URL表达式 + * @param array|integer $params 其它URL参数 + * @param integer $code http code + * @param array $with 隐式传参 + * @return void + */ + protected function redirect($url, $params = [], $code = 302, $with = []) + { + $response = Response::create($url, 'redirect'); + + if (is_integer($params)) { + $code = $params; + $params = []; + } + + $response->code($code)->params($params)->with($with); + + throw new HttpResponseException($response); + } + + /** + * 获取当前的response 输出类型 + * @access protected + * @return string + */ + protected function getResponseType() + { + return $this->request->isJson() ? 'json' : 'html'; + } +} diff --git a/app/controller/Index.php b/app/controller/Index.php index bff26d6..f1caa13 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -1,7 +1,7 @@ Date: Sun, 28 Apr 2019 15:45:59 +0800 Subject: [PATCH 096/186] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8=E7=B1=BB=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/BaseController.php | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/app/controller/BaseController.php b/app/controller/BaseController.php index d60b354..c3d8ee3 100644 --- a/app/controller/BaseController.php +++ b/app/controller/BaseController.php @@ -64,25 +64,6 @@ abstract class BaseController // 控制器初始化 $this->initialize(); - $this->registerMiddleware(); - } - - // 注册控制器中间件 - private function registerMiddleware() - { - foreach ($this->middleware as $key => $val) { - if (!is_int($key)) { - if (isset($val['only']) && !in_array($this->request->action(), $val['only'])) { - continue; - } elseif (isset($val['except']) && in_array($this->request->action(), $val['except'])) { - continue; - } else { - $val = $key; - } - } - - $this->app->middleware->controller($val); - } } // 初始化 @@ -274,6 +255,6 @@ abstract class BaseController */ protected function getResponseType() { - return $this->request->isJson() ? 'json' : 'html'; + return $this->request->isJson() || $this->request->isAjax() ? 'json' : 'html'; } } -- Gitee From aab6f0779511ef01a3b1b66b90000f0ad7ff3e23 Mon Sep 17 00:00:00 2001 From: ThinkPHP Date: Sun, 28 Apr 2019 07:46:27 +0000 Subject: [PATCH 097/186] Apply fixes from StyleCI --- app/controller/BaseController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controller/BaseController.php b/app/controller/BaseController.php index c3d8ee3..0ec7396 100644 --- a/app/controller/BaseController.php +++ b/app/controller/BaseController.php @@ -14,7 +14,6 @@ namespace think; use think\exception\HttpResponseException; use think\exception\ValidateException; -use think\Response; use think\response\Redirect; /** -- Gitee From 6fcb320f089e7be46106e42bf4c2e66ba7436da0 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 28 Apr 2019 17:33:54 +0800 Subject: [PATCH 098/186] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/BaseController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controller/BaseController.php b/app/controller/BaseController.php index c3d8ee3..2a16895 100644 --- a/app/controller/BaseController.php +++ b/app/controller/BaseController.php @@ -10,7 +10,7 @@ // +---------------------------------------------------------------------- declare (strict_types = 1); -namespace think; +namespace app\controller; use think\exception\HttpResponseException; use think\exception\ValidateException; -- Gitee From 70b06e2a6aac8a9e2410edf7318cd9d29c1cfa6e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 28 Apr 2019 17:36:07 +0800 Subject: [PATCH 099/186] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/BaseController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controller/BaseController.php b/app/controller/BaseController.php index d0d75a9..2a16895 100644 --- a/app/controller/BaseController.php +++ b/app/controller/BaseController.php @@ -14,6 +14,7 @@ namespace app\controller; use think\exception\HttpResponseException; use think\exception\ValidateException; +use think\Response; use think\response\Redirect; /** -- Gitee From 820837e1511f9e7b79738a0399bd44fee0024f4e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 29 Apr 2019 08:28:39 +0800 Subject: [PATCH 100/186] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/BaseController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controller/BaseController.php b/app/controller/BaseController.php index 2a16895..b560140 100644 --- a/app/controller/BaseController.php +++ b/app/controller/BaseController.php @@ -12,10 +12,12 @@ declare (strict_types = 1); namespace app\controller; +use think\App; use think\exception\HttpResponseException; use think\exception\ValidateException; use think\Response; use think\response\Redirect; +use think\Validate; /** * 控制器基础类 -- Gitee From cb2a1c97a7779db9491e2900d911ae5823495a4c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 30 Apr 2019 17:55:19 +0800 Subject: [PATCH 101/186] =?UTF-8?q?build=E7=A4=BA=E4=BE=8B=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.php => build.example.php | 12 ++++++------ config/database.php | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) rename build.php => build.example.php (81%) diff --git a/build.php b/build.example.php similarity index 81% rename from build.php rename to build.example.php index 34ba3c8..640421c 100644 --- a/build.php +++ b/build.example.php @@ -9,12 +9,12 @@ // | Author: liu21st // +---------------------------------------------------------------------- +/** + * php think build 自动生成应用目录结构的定义示例 + */ return [ - // 生成应用公共文件 - '__file__' => ['common.php'], - - // 定义demo模块的自动生成 (按照实际定义的文件名生成) - 'demo' => [ + // 定义demo应用的自动生成 + 'demo' => [ '__file__' => ['common.php'], '__dir__' => ['behavior', 'controller', 'model', 'view'], 'controller' => ['Index', 'Test', 'UserType'], @@ -22,5 +22,5 @@ return [ 'view' => ['index/index'], ], - // 其他更多的模块定义 + // 其他更多的应用定义 ]; diff --git a/config/database.php b/config/database.php index 4834854..971c1d7 100644 --- a/config/database.php +++ b/config/database.php @@ -44,8 +44,6 @@ return [ 'slave_no' => '', // 是否严格检查字段是否存在 'fields_strict' => true, - // 数据集返回类型 - 'resultset_type' => 'array', // 自动写入时间戳字段 'auto_timestamp' => false, // 时间字段取出后的默认时间格式 -- Gitee From e16898a19079827e96df6a71fc2638b47663f491 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 30 Apr 2019 18:44:14 +0800 Subject: [PATCH 102/186] =?UTF-8?q?=E5=BA=94=E7=94=A8=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.example.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/build.example.php b/build.example.php index 640421c..0f2222f 100644 --- a/build.example.php +++ b/build.example.php @@ -10,17 +10,17 @@ // +---------------------------------------------------------------------- /** - * php think build 自动生成应用目录结构的定义示例 + * php think build 自动生成应用的目录结构的定义示例 */ return [ - // 定义demo应用的自动生成 - 'demo' => [ - '__file__' => ['common.php'], - '__dir__' => ['behavior', 'controller', 'model', 'view'], - 'controller' => ['Index', 'Test', 'UserType'], - 'model' => ['User', 'UserType'], - 'view' => ['index/index'], - ], - - // 其他更多的应用定义 + // 需要自动创建的文件 + '__file__' => [], + // 需要自动创建的目录 + '__dir__' => ['controller', 'model', 'view'], + // 需要自动创建的控制器 + 'controller' => ['Index'], + // 需要自动创建的模型 + 'model' => ['User'], + // 需要自动创建的模板 + 'view' => ['index/index'], ]; -- Gitee From 343681fe834974cc2cab78c1853898031e77ae63 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 10 May 2019 17:34:52 +0800 Subject: [PATCH 103/186] =?UTF-8?q?=E5=8F=96=E6=B6=88BaseController?= =?UTF-8?q?=E7=B1=BB=E7=9A=84success/error/result/redirect=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/BaseController.php | 135 +----------------------------- 1 file changed, 1 insertion(+), 134 deletions(-) diff --git a/app/controller/BaseController.php b/app/controller/BaseController.php index b560140..fdaebeb 100644 --- a/app/controller/BaseController.php +++ b/app/controller/BaseController.php @@ -13,10 +13,7 @@ declare (strict_types = 1); namespace app\controller; use think\App; -use think\exception\HttpResponseException; use think\exception\ValidateException; -use think\Response; -use think\response\Redirect; use think\Validate; /** @@ -105,7 +102,7 @@ abstract class BaseController // 支持场景 list($validate, $scene) = explode('.', $validate); } - $class = $this->app->parseClass('validate', $validate); + $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); $v = new $class(); if (!empty($scene)) { $v->scene($scene); @@ -129,134 +126,4 @@ abstract class BaseController return true; } - /** - * 操作成功跳转的快捷方法 - * @access protected - * @param mixed $msg 提示信息 - * @param string $url 跳转的URL地址 - * @param mixed $data 返回的数据 - * @param integer $wait 跳转等待时间 - * @param array $header 发送的Header信息 - * @return void - */ - protected function success($msg = '', string $url = null, $data = '', int $wait = 3, array $header = []) - { - if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) { - $url = $_SERVER["HTTP_REFERER"]; - } elseif ($url) { - $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url); - } - - $result = [ - 'code' => 1, - 'msg' => $msg, - 'data' => $data, - 'url' => $url, - 'wait' => $wait, - ]; - - $type = $this->getResponseType(); - // 把跳转模板的渲染下沉,这样在 response_send 行为里通过getData()获得的数据是一致性的格式 - if ('html' == strtolower($type)) { - $type = 'jump'; - } - - $response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app->config->get('app.dispatch_success_tmpl')]); - - throw new HttpResponseException($response); - } - - /** - * 操作错误跳转的快捷方法 - * @access protected - * @param mixed $msg 提示信息 - * @param string $url 跳转的URL地址 - * @param mixed $data 返回的数据 - * @param integer $wait 跳转等待时间 - * @param array $header 发送的Header信息 - * @return void - */ - protected function error($msg = '', string $url = null, $data = '', int $wait = 3, array $header = []) - { - if (is_null($url)) { - $url = $this->request->isAjax() ? '' : 'javascript:history.back(-1);'; - } elseif ($url) { - $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url); - } - - $result = [ - 'code' => 0, - 'msg' => $msg, - 'data' => $data, - 'url' => $url, - 'wait' => $wait, - ]; - - $type = $this->getResponseType(); - if ('html' == strtolower($type)) { - $type = 'jump'; - } - - $response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app->config->get('app.dispatch_error_tmpl')]); - - throw new HttpResponseException($response); - } - - /** - * 返回封装后的API数据到客户端 - * @access protected - * @param mixed $data 要返回的数据 - * @param integer $code 返回的code - * @param mixed $msg 提示信息 - * @param string $type 返回数据格式 - * @param array $header 发送的Header信息 - * @return void - */ - protected function result($data, $code = 0, $msg = '', $type = '', array $header = []) - { - $result = [ - 'code' => $code, - 'msg' => $msg, - 'time' => time(), - 'data' => $data, - ]; - - $type = $type ?: $this->getResponseType(); - $response = Response::create($result, $type)->header($header); - - throw new HttpResponseException($response); - } - - /** - * URL重定向 - * @access protected - * @param string $url 跳转的URL表达式 - * @param array|integer $params 其它URL参数 - * @param integer $code http code - * @param array $with 隐式传参 - * @return void - */ - protected function redirect($url, $params = [], $code = 302, $with = []) - { - $response = Response::create($url, 'redirect'); - - if (is_integer($params)) { - $code = $params; - $params = []; - } - - $response->code($code)->params($params)->with($with); - - throw new HttpResponseException($response); - } - - /** - * 获取当前的response 输出类型 - * @access protected - * @return string - */ - protected function getResponseType() - { - return $this->request->isJson() || $this->request->isAjax() ? 'json' : 'html'; - } } -- Gitee From e96bdf0bc39c506557592760c49d4a01c39b1dc2 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 11 May 2019 20:06:26 +0800 Subject: [PATCH 104/186] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=A7=8B=E7=BB=88=E6=8A=9B=E5=87=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/BaseController.php | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/app/controller/BaseController.php b/app/controller/BaseController.php index fdaebeb..3ed3973 100644 --- a/app/controller/BaseController.php +++ b/app/controller/BaseController.php @@ -33,12 +33,6 @@ abstract class BaseController */ protected $app; - /** - * 验证失败是否抛出异常 - * @var bool - */ - protected $failException = false; - /** * 是否批量验证 * @var bool @@ -69,19 +63,6 @@ abstract class BaseController protected function initialize() {} - /** - * 设置验证失败后是否抛出异常 - * @access protected - * @param bool $fail 是否抛出异常 - * @return $this - */ - protected function validateFailException(bool $fail = true) - { - $this->failException = $fail; - - return $this; - } - /** * 验证数据 * @access protected @@ -116,14 +97,7 @@ abstract class BaseController $v->batch(true); } - if (!$v->check($data)) { - if ($this->failException) { - throw new ValidateException($v->getError()); - } - return $v->getError(); - } - - return true; + return $v->failException(true)->check($data); } } -- Gitee From 88670fbcc3a7c9d40c1857f7ee7928dc806ec189 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 11 May 2019 21:37:39 +0800 Subject: [PATCH 105/186] =?UTF-8?q?=E8=AF=B7=E6=B1=82=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E4=BB=B6=E9=BB=98=E8=AE=A4=E4=B8=8D=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=20=E5=A6=82=E6=9E=9C=E8=AE=BE=E7=BD=AE=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=88=99=E4=B8=BA=E5=BC=80=E5=90=AF=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/middleware.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/middleware.php b/app/middleware.php index 4b351a2..081951f 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -1,7 +1,6 @@ Date: Mon, 13 May 2019 17:37:59 +0800 Subject: [PATCH 106/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0app\Request=20?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E9=A1=B9=E7=9B=AE=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?Request=20app\controller\BaseController=20=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=20app\BaseController?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/{controller => }/BaseController.php | 2 +- app/Request.php | 17 +++++++++++++++++ app/provider.php | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) rename app/{controller => }/BaseController.php (99%) create mode 100644 app/Request.php create mode 100644 app/provider.php diff --git a/app/controller/BaseController.php b/app/BaseController.php similarity index 99% rename from app/controller/BaseController.php rename to app/BaseController.php index 3ed3973..1356436 100644 --- a/app/controller/BaseController.php +++ b/app/BaseController.php @@ -10,7 +10,7 @@ // +---------------------------------------------------------------------- declare (strict_types = 1); -namespace app\controller; +namespace app; use think\App; use think\exception\ValidateException; diff --git a/app/Request.php b/app/Request.php new file mode 100644 index 0000000..bf830dc --- /dev/null +++ b/app/Request.php @@ -0,0 +1,17 @@ + +// +---------------------------------------------------------------------- + +namespace app; + +class Request extends \think\Request +{ + +} diff --git a/app/provider.php b/app/provider.php new file mode 100644 index 0000000..71bb779 --- /dev/null +++ b/app/provider.php @@ -0,0 +1,17 @@ + +// +---------------------------------------------------------------------- + +use app\Request; + +// 容器Provider定义文件 +return [ + 'think\Request' => Request::class, +]; -- Gitee From 9e065467be913d602eaf7164fd2c5b690a69a075 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 13 May 2019 17:52:36 +0800 Subject: [PATCH 107/186] =?UTF-8?q?=E8=B0=83=E6=95=B4session=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/session.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/config/session.php b/config/session.php index ae58357..c4a2f03 100644 --- a/config/session.php +++ b/config/session.php @@ -19,9 +19,7 @@ return [ // SESSION_ID的提交变量,解决flash上传跨域 'var_session_id' => '', // 驱动方式 支持file redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, + 'type' => 'file', // 过期时间 'expire' => 0, ]; -- Gitee From 0d798281d4a6ac7ec1d298cd811ea1556ca36f4a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 13 May 2019 18:13:05 +0800 Subject: [PATCH 108/186] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=8D=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E4=BB=BB=E4=BD=95=E7=B3=BB=E7=BB=9F=E4=B8=AD=E9=97=B4?= =?UTF-8?q?=E4=BB=B6=20=E7=94=B1=E9=A1=B9=E7=9B=AE=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/middleware.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/middleware.php b/app/middleware.php index 081951f..83f2642 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -1,7 +1,12 @@ Date: Mon, 13 May 2019 18:24:33 +0800 Subject: [PATCH 109/186] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/trace.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/trace.php b/config/trace.php index 425d301..2f4a1f5 100644 --- a/config/trace.php +++ b/config/trace.php @@ -10,7 +10,7 @@ // +---------------------------------------------------------------------- // +---------------------------------------------------------------------- -// | Trace设置 开启 app_trace 后 有效 +// | Trace设置 开启调试模式后有效 // +---------------------------------------------------------------------- return [ // 内置Html Console 支持扩展 -- Gitee From dd7f7cffdb61eead078fd6597d14d753c6856a66 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 13 May 2019 18:29:32 +0800 Subject: [PATCH 110/186] =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E6=96=87=E4=BB=B6=E8=B0=83=E6=95=B4=20?= =?UTF-8?q?=E5=8E=BB=E6=8E=89app=5Ftrace=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .example.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.example.env b/.example.env index 4bc3932..c27f74c 100644 --- a/.example.env +++ b/.example.env @@ -1 +1 @@ -APP_DEBUG = true APP_TRACE = false [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = test USERNAME = username PASSWORD = password HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn \ No newline at end of file +APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = test USERNAME = username PASSWORD = password HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn \ No newline at end of file -- Gitee From d636ef7fe2634b948827e1435f16414f4eecefef Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 14 May 2019 14:46:53 +0800 Subject: [PATCH 111/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controller/Index.php b/app/controller/Index.php index f1caa13..d5563b6 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -1,6 +1,8 @@ Date: Fri, 17 May 2019 16:21:00 +0800 Subject: [PATCH 112/186] =?UTF-8?q?app=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= =?UTF-8?q?=20=E5=8F=96=E6=B6=88=E4=B8=8D=E5=86=8D=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84dispatch=5Fsuccess=5Ftmpl=E5=92=8Cdispatch=5Ferror=5Ft?= =?UTF-8?q?mpl=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/config/app.php b/config/app.php index 018a12f..5c232f7 100644 --- a/config/app.php +++ b/config/app.php @@ -17,39 +17,35 @@ use think\facade\Env; return [ // 应用地址 - 'app_host' => Env::get('app.host', ''), + 'app_host' => Env::get('app.host', ''), // 应用Trace(环境变量优先读取) - 'app_trace' => false, + 'app_trace' => false, // 应用的命名空间 - 'app_namespace' => '', + 'app_namespace' => '', // 是否启用路由 - 'with_route' => true, + 'with_route' => true, // 是否启用事件 - 'with_event' => true, + 'with_event' => true, // 自动多应用模式 - 'auto_multi_app' => false, + 'auto_multi_app' => false, // 应用映射(自动多应用模式有效) - 'app_map' => [], + 'app_map' => [], // 域名绑定(自动多应用模式有效) - 'domain_bind' => [], + 'domain_bind' => [], // 禁止URL访问的应用列表(自动多应用模式有效) - 'deny_app_list' => [], + 'deny_app_list' => [], // 默认应用 - 'default_app' => 'index', + 'default_app' => 'index', // 默认时区 - 'default_timezone' => 'Asia/Shanghai', + 'default_timezone' => 'Asia/Shanghai', // 默认验证器 - 'default_validate' => '', - - // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => app()->getThinkPath() . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => app()->getThinkPath() . 'tpl/dispatch_jump.tpl', + 'default_validate' => '', // 异常页面的模板文件 - 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', + 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', + 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => false, + 'show_error_msg' => false, ]; -- Gitee From fee91f7c32926de7326f788b855b75b47f66376f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 23 May 2019 16:43:08 +0800 Subject: [PATCH 113/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ExceptionHandle.php | 51 +++++++++++++++++++++++++++++++++++++++++ app/provider.php | 4 +++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 app/ExceptionHandle.php diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php new file mode 100644 index 0000000..302b900 --- /dev/null +++ b/app/ExceptionHandle.php @@ -0,0 +1,51 @@ + +// +---------------------------------------------------------------------- + +namespace app; + +use think\exception\Handle; +use think\Response; +use Throwable; + +/** + * 应用异常处理类 + */ +class ExceptionHandle extends Handle +{ + /** + * 记录异常信息(包括日志或者其它方式记录) + * + * @access public + * @param Throwable $exception + * @return void + */ + public function report(Throwable $exception): void + { + // 使用内置的方式记录异常日志 + parent::report($exception); + } + + /** + * Render an exception into an HTTP response. + * + * @access public + * @param \think\Request $request + * @param Throwable $e + * @return Response + */ + public function render($request, Throwable $e): Response + { + // 添加自定义异常处理机制 + + // 其他错误交给系统处理 + return parent::render($request, $e); + } +} diff --git a/app/provider.php b/app/provider.php index 71bb779..c9b41d3 100644 --- a/app/provider.php +++ b/app/provider.php @@ -9,9 +9,11 @@ // | Author: liu21st // +---------------------------------------------------------------------- +use app\ExceptionHandle; use app\Request; // 容器Provider定义文件 return [ - 'think\Request' => Request::class, + 'think\Request' => Request::class, + 'think\exception\Handle' => ExceptionHandle::class, ]; -- Gitee From 878d0d95080f98b847218d1adaa6f2e0fe3d7814 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 29 May 2019 11:16:02 +0800 Subject: [PATCH 114/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/app.php b/config/app.php index 5c232f7..274c2ad 100644 --- a/config/app.php +++ b/config/app.php @@ -18,8 +18,6 @@ use think\facade\Env; return [ // 应用地址 'app_host' => Env::get('app.host', ''), - // 应用Trace(环境变量优先读取) - 'app_trace' => false, // 应用的命名空间 'app_namespace' => '', // 是否启用路由 -- Gitee From 0697b6cb708c68407c5444b4975578b8b7101b54 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 29 May 2019 11:34:20 +0800 Subject: [PATCH 115/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/app.php b/config/app.php index 274c2ad..51b737c 100644 --- a/config/app.php +++ b/config/app.php @@ -36,8 +36,6 @@ return [ 'default_app' => 'index', // 默认时区 'default_timezone' => 'Asia/Shanghai', - // 默认验证器 - 'default_validate' => '', // 异常页面的模板文件 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', -- Gitee From 0f9fc30f4f01f16c791bfa8aff736c3b094a8908 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 29 May 2019 16:33:18 +0800 Subject: [PATCH 116/186] =?UTF-8?q?lang=E9=85=8D=E7=BD=AE=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/lang.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/lang.php b/config/lang.php index c0c3e65..693a490 100644 --- a/config/lang.php +++ b/config/lang.php @@ -20,8 +20,6 @@ return [ 'default_lang' => Env::get('lang.default_lang', 'zh-cn'), // 允许的语言列表 'allow_lang_list' => [], - // 是否开启自动侦测 - 'auto_detect' => false, // 多语言自动侦测变量名 'detect_var' => 'lang', // 是否使用Cookie记录 -- Gitee From 147c151d8585ac472664abac1b528d758f096f28 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 29 May 2019 20:01:50 +0800 Subject: [PATCH 117/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0symfony/var-dumper?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 05b4556..f0211eb 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "require": { "php": ">=7.1.0", "topthink/framework": "6.0.*-dev", - "topthink/think-view": "^1.0" + "topthink/think-view": "^1.0", + "symfony/var-dumper":"^4.2" }, "autoload": { "psr-4": { -- Gitee From 296f1e8111afde16f86d162675612425e82fcbda Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 30 May 2019 11:43:14 +0800 Subject: [PATCH 118/186] =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cache.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/config/cache.php b/config/cache.php index 985dbb1..c9c50e5 100644 --- a/config/cache.php +++ b/config/cache.php @@ -15,11 +15,15 @@ return [ // 驱动方式 - 'type' => 'File', + 'type' => 'File', // 缓存保存目录 - 'path' => '', + 'path' => '', // 缓存前缀 - 'prefix' => '', + 'prefix' => '', // 缓存有效期 0表示永久缓存 - 'expire' => 0, + 'expire' => 0, + // 缓存标签前缀 + 'tag_prefix' => 'tag:', + // 序列化机制 例如 ['serialize', 'unserialize'] + 'serialize' => [], ]; -- Gitee From ce5f3e978b58e45a4933721b27f3da1aa14343cc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 31 May 2019 09:47:15 +0800 Subject: [PATCH 119/186] =?UTF-8?q?readme=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index b540dd7..34e0e3e 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,20 @@ ThinkPHP 6.0 > 运行环境要求PHP7.1+。 +## 主要新特性 + +* 采用`PHP7`强类型(严格模式) +* 支持更多的`PSR`规范 +* 原生多应用支持 +* 更强大和易用的查询 +* 全新的事件系统 +* 模型事件和数据库事件统一纳入事件系统 +* 模板引擎分离出核心 +* 内部功能中间件化 +* SESSION/Cookie机制改进 +* 对Swoole以及协程支持改进 +* 对IDE更加友好 +* 统一和精简大量用法 ## 安装 @@ -15,6 +29,10 @@ composer create-project topthink/think tp 6.0.*-dev composer update topthink/framework ~~~ +## 文档 + +[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content) + ## 参与开发 请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。 -- Gitee From e400bb545b0e8709a6b4243f7c73ec0059e0a20e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 8 Jun 2019 19:42:52 +0800 Subject: [PATCH 120/186] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index a3d20e0..d465120 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ /.vscode /vendor *.log -thinkphp .env \ No newline at end of file -- Gitee From 914a1c9315cb3a408907ce2b3a922d7834431e03 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 12 Jun 2019 11:48:39 +0800 Subject: [PATCH 121/186] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/route.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/route.php b/config/route.php index 16cda60..5b52dd8 100644 --- a/config/route.php +++ b/config/route.php @@ -50,8 +50,6 @@ return [ 'controller_suffix' => false, // 默认的路由变量规则 'default_route_pattern' => '[\w\.]+', - // 域名根,如thinkphp.cn - 'url_domain_root' => '', // 是否自动转换URL中的控制器和操作名 'url_convert' => true, // 表单请求类型伪装变量 -- Gitee From c3e9ed9b990a42442154f2516b2b7f1efcd29982 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 12 Jun 2019 18:09:31 +0800 Subject: [PATCH 122/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=B9=B6=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ExceptionHandle.php | 17 +++++++++++++++++ app/middleware.php | 8 ++++---- config/route.php | 12 ------------ config/session.php | 2 ++ config/trace.php | 2 +- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php index 302b900..348af09 100644 --- a/app/ExceptionHandle.php +++ b/app/ExceptionHandle.php @@ -11,7 +11,12 @@ namespace app; +use think\exception\DataNotFoundException; use think\exception\Handle; +use think\exception\HttpException; +use think\exception\HttpResponseException; +use think\exception\ModelNotFoundException; +use think\exception\ValidateException; use think\Response; use Throwable; @@ -20,6 +25,18 @@ use Throwable; */ class ExceptionHandle extends Handle { + /** + * 不需要记录信息(日志)的异常类列表 + * @var array + */ + protected $ignoreReport = [ + HttpException::class, + HttpResponseException::class, + ModelNotFoundException::class, + DataNotFoundException::class, + ValidateException::class, + ]; + /** * 记录异常信息(包括日志或者其它方式记录) * diff --git a/app/middleware.php b/app/middleware.php index 83f2642..e599093 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -2,11 +2,11 @@ return [ // 全局请求缓存 - // 'think\middleware\CheckRequestCache', + // \think\middleware\CheckRequestCache::class, // 多语言加载 - // 'think\middleware\LoadLangPack', + // \think\middleware\LoadLangPack::class, // Session初始化 - // 'think\middleware\SessionInit', + // \think\middleware\SessionInit::class, // 页面Trace调试 - // 'think\middleware\TraceDebug', + // \think\middleware\TraceDebug::class, ]; diff --git a/config/route.php b/config/route.php index 5b52dd8..1a6048d 100644 --- a/config/route.php +++ b/config/route.php @@ -14,14 +14,8 @@ // +---------------------------------------------------------------------- return [ - // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', - // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], // pathinfo分隔符 'pathinfo_depr' => '/', - // HTTPS代理标识 - 'https_agent_name' => '', // URL伪静态后缀 'url_html_suffix' => 'html', // URL普通方式参数 用于自动生成 @@ -52,12 +46,6 @@ return [ 'default_route_pattern' => '[\w\.]+', // 是否自动转换URL中的控制器和操作名 'url_convert' => true, - // 表单请求类型伪装变量 - 'var_method' => '_method', - // 表单ajax伪装变量 - 'var_ajax' => '_ajax', - // 表单pjax伪装变量 - 'var_pjax' => '_pjax', // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 'request_cache' => false, // 请求缓存有效期 diff --git a/config/session.php b/config/session.php index c4a2f03..7a2527a 100644 --- a/config/session.php +++ b/config/session.php @@ -22,4 +22,6 @@ return [ 'type' => 'file', // 过期时间 'expire' => 0, + // 前缀 + 'prefix' => '', ]; diff --git a/config/trace.php b/config/trace.php index 2f4a1f5..da33a46 100644 --- a/config/trace.php +++ b/config/trace.php @@ -13,6 +13,6 @@ // | Trace设置 开启调试模式后有效 // +---------------------------------------------------------------------- return [ - // 内置Html Console 支持扩展 + // 内置Html 支持扩展 'type' => 'Html', ]; -- Gitee From d761feb16dac8cd99dc4fd8c40fe1c9861b5375a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 13 Jun 2019 10:12:11 +0800 Subject: [PATCH 123/186] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ExceptionHandle.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php index 348af09..375e841 100644 --- a/app/ExceptionHandle.php +++ b/app/ExceptionHandle.php @@ -11,11 +11,11 @@ namespace app; -use think\exception\DataNotFoundException; +use think\db\exception\DataNotFoundException; +use think\db\exception\ModelNotFoundException; use think\exception\Handle; use think\exception\HttpException; use think\exception\HttpResponseException; -use think\exception\ModelNotFoundException; use think\exception\ValidateException; use think\Response; use Throwable; -- Gitee From 5c41421fe246c93ac3b8566a5b8d4f8043b67bbc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 14 Jun 2019 15:28:24 +0800 Subject: [PATCH 124/186] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=92=8C?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cache.php | 34 +++++++++++------ config/database.php | 92 ++++++++++++++++++++++++--------------------- 2 files changed, 72 insertions(+), 54 deletions(-) diff --git a/config/cache.php b/config/cache.php index c9c50e5..dc54123 100644 --- a/config/cache.php +++ b/config/cache.php @@ -8,22 +8,32 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- +use think\facade\Env; // +---------------------------------------------------------------------- // | 缓存设置 // +---------------------------------------------------------------------- return [ - // 驱动方式 - 'type' => 'File', - // 缓存保存目录 - 'path' => '', - // 缓存前缀 - 'prefix' => '', - // 缓存有效期 0表示永久缓存 - 'expire' => 0, - // 缓存标签前缀 - 'tag_prefix' => 'tag:', - // 序列化机制 例如 ['serialize', 'unserialize'] - 'serialize' => [], + // 默认缓存驱动 + 'default' => Env::get('cache.driver', 'file'), + + // 缓存连接方式配置 + 'stores' => [ + 'file' => [ + // 驱动方式 + 'type' => 'File', + // 缓存保存目录 + 'path' => '', + // 缓存前缀 + 'prefix' => '', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, + // 缓存标签前缀 + 'tag_prefix' => 'tag:', + // 序列化机制 例如 ['serialize', 'unserialize'] + 'serialize' => [], + ], + // 更多的缓存连接 + ], ]; diff --git a/config/database.php b/config/database.php index 971c1d7..71774a0 100644 --- a/config/database.php +++ b/config/database.php @@ -12,50 +12,58 @@ use think\facade\Env; return [ - // 数据库类型 - 'type' => Env::get('database.type', 'mysql'), - // 服务器地址 - 'hostname' => Env::get('database.hostname', '127.0.0.1'), - // 数据库名 - 'database' => Env::get('database.database', ''), - // 用户名 - 'username' => Env::get('database.username', 'root'), - // 密码 - 'password' => Env::get('database.password', ''), - // 端口 - 'hostport' => Env::get('database.hostport', '3306'), - // 连接dsn - 'dsn' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => Env::get('database.charset', 'utf8'), - // 数据库表前缀 - 'prefix' => Env::get('database.prefix', ''), - // 数据库调试模式 - 'debug' => Env::get('database.debug', true), - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 是否严格检查字段是否存在 - 'fields_strict' => true, + // 默认使用的数据库连接配置 + 'default' => Env::get('database.driver', 'mysql'), + + // 数据库连接配置信息 + 'connections' => [ + 'mysql' => [ + // 数据库类型 + 'type' => Env::get('database.type', 'mysql'), + // 服务器地址 + 'hostname' => Env::get('database.hostname', '127.0.0.1'), + // 数据库名 + 'database' => Env::get('database.database', ''), + // 用户名 + 'username' => Env::get('database.username', 'root'), + // 密码 + 'password' => Env::get('database.password', ''), + // 端口 + 'hostport' => Env::get('database.hostport', '3306'), + // 连接dsn + 'dsn' => '', + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => Env::get('database.charset', 'utf8'), + // 数据库表前缀 + 'prefix' => Env::get('database.prefix', ''), + // 数据库调试模式 + 'debug' => Env::get('database.debug', true), + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 是否需要进行SQL性能分析 + 'sql_explain' => false, + // Builder类 + 'builder' => '', + // Query类 + 'query' => '', + // 是否需要断线重连 + 'break_reconnect' => false, + ], + + // 更多的数据库配置信息 + ], // 自动写入时间戳字段 'auto_timestamp' => false, // 时间字段取出后的默认时间格式 'datetime_format' => 'Y-m-d H:i:s', - // 是否需要进行SQL性能分析 - 'sql_explain' => false, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '\\think\\db\\Query', - // 是否需要断线重连 - 'break_reconnect' => false, - // 断线标识字符串 - 'break_match_str' => [], ]; -- Gitee From 2b77366983d469ad29fea4bf2efd120b71917231 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Fri, 14 Jun 2019 18:53:12 +0800 Subject: [PATCH 125/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0filesystem=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/filesystem.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 config/filesystem.php diff --git a/config/filesystem.php b/config/filesystem.php new file mode 100644 index 0000000..a0c5744 --- /dev/null +++ b/config/filesystem.php @@ -0,0 +1,20 @@ + Env::get('filesystem.driver', 'local'), + 'disks' => [ + 'local' => [ + 'driver' => 'local', + 'root' => app()->getRuntimePath() . 'storage', + ], + 'public' => [ + 'driver' => 'local', + 'root' => app()->getRootPath() . 'public/storage', + 'url' => '/storage', + 'visibility' => 'public', + ], + // 更多的磁盘配置信息 + ], +]; -- Gitee From 9e046eab322ec3897b3231dab3715f1152307669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AF=BA=E5=A2=A8?= Date: Sun, 16 Jun 2019 17:50:09 +0800 Subject: [PATCH 126/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E5=88=86=E7=BB=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补充默认配置选项 --- config/lang.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/lang.php b/config/lang.php index 693a490..7659eaa 100644 --- a/config/lang.php +++ b/config/lang.php @@ -32,4 +32,6 @@ return [ 'accept_language' => [ 'zh-hans-cn' => 'zh-cn', ], + // 是否支持语言分组 + 'allow_group' => false, ]; -- Gitee From 83f2989ef08e1fe30b7fa8bdc1de74c2c7a0e33c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 19 Jun 2019 15:39:47 +0800 Subject: [PATCH 127/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.php b/config/database.php index 71774a0..18f7efe 100644 --- a/config/database.php +++ b/config/database.php @@ -63,7 +63,7 @@ return [ // 更多的数据库配置信息 ], // 自动写入时间戳字段 - 'auto_timestamp' => false, + 'auto_timestamp' => 'timestamp', // 时间字段取出后的默认时间格式 'datetime_format' => 'Y-m-d H:i:s', ]; -- Gitee From 2bd5c73e3b06d133f8fead7c73d1e3dfa875ddb6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 20 Jun 2019 19:24:55 +0800 Subject: [PATCH 128/186] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/database.php b/config/database.php index 18f7efe..a93f629 100644 --- a/config/database.php +++ b/config/database.php @@ -62,6 +62,9 @@ return [ // 更多的数据库配置信息 ], + + // 自定义时间查询规则 + 'time_query_rule' => [], // 自动写入时间戳字段 'auto_timestamp' => 'timestamp', // 时间字段取出后的默认时间格式 -- Gitee From 66ed1feeafd5d89cf44009337a8d6e388a5d4297 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Fri, 21 Jun 2019 16:46:08 +0800 Subject: [PATCH 129/186] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/filesystem.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/filesystem.php b/config/filesystem.php index a0c5744..b6a0c5c 100644 --- a/config/filesystem.php +++ b/config/filesystem.php @@ -6,11 +6,11 @@ return [ 'default' => Env::get('filesystem.driver', 'local'), 'disks' => [ 'local' => [ - 'driver' => 'local', - 'root' => app()->getRuntimePath() . 'storage', + 'type' => 'local', + 'root' => app()->getRuntimePath() . 'storage', ], 'public' => [ - 'driver' => 'local', + 'type' => 'local', 'root' => app()->getRootPath() . 'public/storage', 'url' => '/storage', 'visibility' => 'public', -- Gitee From f029976bed38b67f9fe6a6f2ece5f3e1279867c3 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 22 Jun 2019 22:38:36 +0800 Subject: [PATCH 130/186] =?UTF-8?q?=E6=97=A5=E5=BF=97=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=A0=BC=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/log.php | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/config/log.php b/config/log.php index b3d87b4..9650879 100644 --- a/config/log.php +++ b/config/log.php @@ -8,23 +8,35 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- +use think\facade\Env; // +---------------------------------------------------------------------- // | 日志设置 // +---------------------------------------------------------------------- return [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - // 日志保存目录 - 'path' => '', + // 默认日志记录通道 + 'default' => Env::get('log.channel', 'file'), // 日志记录级别 - 'level' => [], - // 单文件日志写入 - 'single' => false, - // 独立日志级别 - 'apart_level' => [], - // 最大日志文件数量 - 'max_files' => 0, + 'level' => [], + // 日志类型记录的通道 ['error'=>'email',...] + 'type_channel' => [], // 是否关闭日志写入 - 'close' => false, + 'close' => false, + + // 日志通道列表 + 'channels' => [ + 'file' => [ + // 日志记录方式 + 'type' => 'File', + // 日志保存目录 + 'path' => '', + // 单文件日志写入 + 'single' => false, + // 独立日志级别 + 'apart_level' => [], + // 最大日志文件数量 + 'max_files' => 0, + ], + // 其它日志通道配置 + ], ]; -- Gitee From 2bc3b199d21dc8742d37ef2034ef5334f3c0a0ed Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Mon, 24 Jun 2019 11:46:45 +0800 Subject: [PATCH 131/186] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=B3=A8=E8=A7=A3?= =?UTF-8?q?=E5=B7=B2=E7=A7=BB=E5=87=BA=E6=A0=B8=E5=BF=83=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/route.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/route.php b/config/route.php index 1a6048d..36686a6 100644 --- a/config/route.php +++ b/config/route.php @@ -28,8 +28,6 @@ return [ 'route_rule_merge' => false, // 路由是否完全匹配 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, // 是否开启路由缓存 'route_check_cache' => false, // 路由缓存连接参数 -- Gitee From 33e8c1175b72f5c27ce87ad0ff1b401a3cd6aff4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 25 Jun 2019 18:43:21 +0800 Subject: [PATCH 132/186] =?UTF-8?q?=E6=97=A5=E5=BF=97=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A2=9E=E5=8A=A0processor=E5=8F=82=E6=95=B0?= =?UTF-8?q?=20=E5=8F=96=E6=B6=88allow=5Fkey=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/log.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/log.php b/config/log.php index 9650879..e56f157 100644 --- a/config/log.php +++ b/config/log.php @@ -22,6 +22,8 @@ return [ 'type_channel' => [], // 是否关闭日志写入 'close' => false, + // 全局日志处理 支持闭包 + 'processor' => null, // 日志通道列表 'channels' => [ @@ -36,7 +38,10 @@ return [ 'apart_level' => [], // 最大日志文件数量 'max_files' => 0, + // 日志处理 + 'processor' => null, ], // 其它日志通道配置 ], + ]; -- Gitee From f74850eb79c54ccf403426da623b7462fb72d90f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 25 Jun 2019 19:01:31 +0800 Subject: [PATCH 133/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/log.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/log.php b/config/log.php index e56f157..d472235 100644 --- a/config/log.php +++ b/config/log.php @@ -38,6 +38,8 @@ return [ 'apart_level' => [], // 最大日志文件数量 'max_files' => 0, + // 使用JSON格式记录 + 'json' => false, // 日志处理 'processor' => null, ], -- Gitee From 17b9d0fb86d663d6966b4fa3499a7a16d47b31c4 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Thu, 27 Jun 2019 11:56:07 +0800 Subject: [PATCH 134/186] =?UTF-8?q?var=5Fdump=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=94=BE=E5=88=B0dev=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f0211eb..cba19fd 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,10 @@ "require": { "php": ">=7.1.0", "topthink/framework": "6.0.*-dev", - "topthink/think-view": "^1.0", - "symfony/var-dumper":"^4.2" + "topthink/think-view": "^1.0" + }, + "require-dev": { + "symfony/var-dumper": "^4.2" }, "autoload": { "psr-4": { -- Gitee From 0a6fd99e156dbcfa6aa84be18c5f060a8f564fff Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 27 Jun 2019 14:21:51 +0800 Subject: [PATCH 135/186] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/config/database.php b/config/database.php index a93f629..a9a01e8 100644 --- a/config/database.php +++ b/config/database.php @@ -15,6 +15,17 @@ return [ // 默认使用的数据库连接配置 'default' => Env::get('database.driver', 'mysql'), + // 自定义时间查询规则 + 'time_query_rule' => [], + + // 自动写入时间戳字段 + // true为自动识别类型 false关闭 + // 字符串则明确指定时间字段类型 支持 int timestamp datetime date + 'auto_timestamp' => true, + + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + // 数据库连接配置信息 'connections' => [ 'mysql' => [ @@ -30,8 +41,6 @@ return [ 'password' => Env::get('database.password', ''), // 端口 'hostport' => Env::get('database.hostport', '3306'), - // 连接dsn - 'dsn' => '', // 数据库连接参数 'params' => [], // 数据库编码默认采用utf8 @@ -52,21 +61,10 @@ return [ 'fields_strict' => true, // 是否需要进行SQL性能分析 'sql_explain' => false, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '', // 是否需要断线重连 'break_reconnect' => false, ], // 更多的数据库配置信息 ], - - // 自定义时间查询规则 - 'time_query_rule' => [], - // 自动写入时间戳字段 - 'auto_timestamp' => 'timestamp', - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', ]; -- Gitee From b449ec20d2e28cccc611f8a3d341304fd6bdcf28 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 28 Jun 2019 14:36:25 +0800 Subject: [PATCH 136/186] =?UTF-8?q?=E6=97=A5=E5=BF=97=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/log.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/log.php b/config/log.php index d472235..f3de226 100644 --- a/config/log.php +++ b/config/log.php @@ -20,7 +20,7 @@ return [ 'level' => [], // 日志类型记录的通道 ['error'=>'email',...] 'type_channel' => [], - // 是否关闭日志写入 + // 关闭全局日志写入 'close' => false, // 全局日志处理 支持闭包 'processor' => null, @@ -42,6 +42,8 @@ return [ 'json' => false, // 日志处理 'processor' => null, + // 关闭通道日志写入 + 'close' => false, ], // 其它日志通道配置 ], -- Gitee From c86bbd8e3cc086139dfaee92a7d5632e213f4682 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 28 Jun 2019 22:59:05 +0800 Subject: [PATCH 137/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/log.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/log.php b/config/log.php index f3de226..47c726d 100644 --- a/config/log.php +++ b/config/log.php @@ -44,6 +44,8 @@ return [ 'processor' => null, // 关闭通道日志写入 'close' => false, + // 日志输出格式化 + 'format' => '[%s][%s] %s', ], // 其它日志通道配置 ], -- Gitee From 0f52bcb420c9a749176d788a59375af4c7c5e206 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 29 Jun 2019 21:46:38 +0800 Subject: [PATCH 138/186] =?UTF-8?q?=E6=97=A5=E5=BF=97=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E5=A2=9E=E5=8A=A0view=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/log.php | 20 +++++++++++--------- view/.gitignore | 2 ++ 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 view/.gitignore diff --git a/config/log.php b/config/log.php index 47c726d..493234a 100644 --- a/config/log.php +++ b/config/log.php @@ -29,23 +29,25 @@ return [ 'channels' => [ 'file' => [ // 日志记录方式 - 'type' => 'File', + 'type' => 'File', // 日志保存目录 - 'path' => '', + 'path' => '', // 单文件日志写入 - 'single' => false, + 'single' => false, // 独立日志级别 - 'apart_level' => [], + 'apart_level' => [], // 最大日志文件数量 - 'max_files' => 0, + 'max_files' => 0, // 使用JSON格式记录 - 'json' => false, + 'json' => false, // 日志处理 - 'processor' => null, + 'processor' => null, // 关闭通道日志写入 - 'close' => false, + 'close' => false, // 日志输出格式化 - 'format' => '[%s][%s] %s', + 'format' => '[%s][%s] %s', + // 是否实时写入 + 'realtime_write' => false, ], // 其它日志通道配置 ], diff --git a/view/.gitignore b/view/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/view/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore -- Gitee From 953c95aefadacb6d2fa482129aa81854a6e7d86f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 29 Jun 2019 21:52:02 +0800 Subject: [PATCH 139/186] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/.gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/view/.gitignore b/view/.gitignore index d6b7ef3..6c7b69a 100644 --- a/view/.gitignore +++ b/view/.gitignore @@ -1,2 +1 @@ -* -!.gitignore +.gitignore -- Gitee From 49f91b70c436eca752bb7db8e09d7eebdce3bbe0 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 29 Jun 2019 21:57:05 +0800 Subject: [PATCH 140/186] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/.gitignore | 1 - view/README.md | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 view/.gitignore create mode 100644 view/README.md diff --git a/view/.gitignore b/view/.gitignore deleted file mode 100644 index 6c7b69a..0000000 --- a/view/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.gitignore diff --git a/view/README.md b/view/README.md new file mode 100644 index 0000000..360eb24 --- /dev/null +++ b/view/README.md @@ -0,0 +1 @@ +如果不使用模板,可以删除该目录 \ No newline at end of file -- Gitee From 72286ee7acf5a02e1b61a39f9f1fcd8fad69d1d9 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 2 Jul 2019 16:39:40 +0800 Subject: [PATCH 141/186] =?UTF-8?q?trace=E9=85=8D=E7=BD=AE=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/trace.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/trace.php b/config/trace.php index da33a46..e268f3a 100644 --- a/config/trace.php +++ b/config/trace.php @@ -14,5 +14,7 @@ // +---------------------------------------------------------------------- return [ // 内置Html 支持扩展 - 'type' => 'Html', + 'type' => 'Html', + // 读取的日志通道名 + 'channel' => '', ]; -- Gitee From 4928b95be34aef0e08e6b6afa82505e9a40045e5 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 8 Jul 2019 17:35:54 +0800 Subject: [PATCH 142/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cache.php | 2 +- config/log.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cache.php b/config/cache.php index dc54123..23f82b4 100644 --- a/config/cache.php +++ b/config/cache.php @@ -24,7 +24,7 @@ return [ // 驱动方式 'type' => 'File', // 缓存保存目录 - 'path' => '', + 'path' => app()->getRuntimePath() . 'cache', // 缓存前缀 'prefix' => '', // 缓存有效期 0表示永久缓存 diff --git a/config/log.php b/config/log.php index 493234a..1f8d330 100644 --- a/config/log.php +++ b/config/log.php @@ -31,7 +31,7 @@ return [ // 日志记录方式 'type' => 'File', // 日志保存目录 - 'path' => '', + 'path' => app()->getRuntimePath() . 'log', // 单文件日志写入 'single' => false, // 独立日志级别 -- Gitee From a8e0e49d6bc9a3e62fd708da252cab9670b31e02 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 13 Jul 2019 21:53:24 +0800 Subject: [PATCH 143/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cache.php | 2 +- config/log.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cache.php b/config/cache.php index 23f82b4..dc54123 100644 --- a/config/cache.php +++ b/config/cache.php @@ -24,7 +24,7 @@ return [ // 驱动方式 'type' => 'File', // 缓存保存目录 - 'path' => app()->getRuntimePath() . 'cache', + 'path' => '', // 缓存前缀 'prefix' => '', // 缓存有效期 0表示永久缓存 diff --git a/config/log.php b/config/log.php index 1f8d330..493234a 100644 --- a/config/log.php +++ b/config/log.php @@ -31,7 +31,7 @@ return [ // 日志记录方式 'type' => 'File', // 日志保存目录 - 'path' => app()->getRuntimePath() . 'log', + 'path' => '', // 单文件日志写入 'single' => false, // 独立日志级别 -- Gitee From ccc0e66d97f3db61e9f6969f309a52e42698aeda Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 16 Jul 2019 12:06:06 +0800 Subject: [PATCH 144/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/route.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/route.php b/config/route.php index 36686a6..0b0e592 100644 --- a/config/route.php +++ b/config/route.php @@ -42,8 +42,6 @@ return [ 'controller_suffix' => false, // 默认的路由变量规则 'default_route_pattern' => '[\w\.]+', - // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 'request_cache' => false, // 请求缓存有效期 -- Gitee From af30673503fc83fb1441bd2fd600dd1cc95c0fbf Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 16 Jul 2019 17:49:46 +0800 Subject: [PATCH 145/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/config/database.php b/config/database.php index a9a01e8..2465d05 100644 --- a/config/database.php +++ b/config/database.php @@ -30,39 +30,41 @@ return [ 'connections' => [ 'mysql' => [ // 数据库类型 - 'type' => Env::get('database.type', 'mysql'), + 'type' => Env::get('database.type', 'mysql'), // 服务器地址 - 'hostname' => Env::get('database.hostname', '127.0.0.1'), + 'hostname' => Env::get('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => Env::get('database.database', ''), + 'database' => Env::get('database.database', ''), // 用户名 - 'username' => Env::get('database.username', 'root'), + 'username' => Env::get('database.username', 'root'), // 密码 - 'password' => Env::get('database.password', ''), + 'password' => Env::get('database.password', ''), // 端口 - 'hostport' => Env::get('database.hostport', '3306'), + 'hostport' => Env::get('database.hostport', '3306'), // 数据库连接参数 - 'params' => [], + 'params' => [], // 数据库编码默认采用utf8 - 'charset' => Env::get('database.charset', 'utf8'), + 'charset' => Env::get('database.charset', 'utf8'), // 数据库表前缀 - 'prefix' => Env::get('database.prefix', ''), + 'prefix' => Env::get('database.prefix', ''), // 数据库调试模式 - 'debug' => Env::get('database.debug', true), + 'debug' => Env::get('database.debug', true), // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, + 'deploy' => 0, // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, + 'rw_separate' => false, // 读写分离后 主服务器数量 - 'master_num' => 1, + 'master_num' => 1, // 指定从服务器序号 - 'slave_no' => '', + 'slave_no' => '', // 是否严格检查字段是否存在 - 'fields_strict' => true, + 'fields_strict' => true, // 是否需要进行SQL性能分析 - 'sql_explain' => false, + 'sql_explain' => false, // 是否需要断线重连 - 'break_reconnect' => false, + 'break_reconnect' => false, + // 字段缓存路径 + 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, ], // 更多的数据库配置信息 -- Gitee From 0fbf4a0587e6532d3021e21b8ed2261873a4dcf4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 16 Jul 2019 17:50:11 +0800 Subject: [PATCH 146/186] =?UTF-8?q?=E4=BE=9D=E8=B5=96=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index cba19fd..44a2554 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "require": { "php": ">=7.1.0", "topthink/framework": "6.0.*-dev", + "topthink/think-orm": "2.0.*-dev", "topthink/think-view": "^1.0" }, "require-dev": { -- Gitee From 2f8c1eba4ac08ffe44c704d94f667598251ebbc7 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Thu, 18 Jul 2019 17:58:18 +0800 Subject: [PATCH 147/186] =?UTF-8?q?=E5=BA=9F=E5=BC=83console.user=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=20=E6=94=B9=E4=B8=BA=E5=85=A5=E5=8F=A3=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=87=8C=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/console.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/console.php b/config/console.php index cf6b4ec..27b516e 100644 --- a/config/console.php +++ b/config/console.php @@ -13,8 +13,6 @@ // | 控制台配置 // +---------------------------------------------------------------------- return [ - // 执行用户(Windows下无效) - 'user' => null, // 指令定义 'commands' => [ ], -- Gitee From 1ed61317728aed2d3c2e720c5fe2a5097881db27 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 24 Jul 2019 22:55:31 +0800 Subject: [PATCH 148/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/config/database.php b/config/database.php index a9a01e8..d53f952 100644 --- a/config/database.php +++ b/config/database.php @@ -30,39 +30,39 @@ return [ 'connections' => [ 'mysql' => [ // 数据库类型 - 'type' => Env::get('database.type', 'mysql'), + 'type' => Env::get('database.type', 'mysql'), // 服务器地址 - 'hostname' => Env::get('database.hostname', '127.0.0.1'), + 'hostname' => Env::get('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => Env::get('database.database', ''), + 'database' => Env::get('database.database', ''), // 用户名 - 'username' => Env::get('database.username', 'root'), + 'username' => Env::get('database.username', 'root'), // 密码 - 'password' => Env::get('database.password', ''), + 'password' => Env::get('database.password', ''), // 端口 - 'hostport' => Env::get('database.hostport', '3306'), + 'hostport' => Env::get('database.hostport', '3306'), // 数据库连接参数 - 'params' => [], + 'params' => [], // 数据库编码默认采用utf8 - 'charset' => Env::get('database.charset', 'utf8'), + 'charset' => Env::get('database.charset', 'utf8'), // 数据库表前缀 - 'prefix' => Env::get('database.prefix', ''), + 'prefix' => Env::get('database.prefix', ''), // 数据库调试模式 - 'debug' => Env::get('database.debug', true), + 'debug' => Env::get('database.debug', true), // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, + 'deploy' => 0, // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, + 'rw_separate' => false, // 读写分离后 主服务器数量 - 'master_num' => 1, + 'master_num' => 1, // 指定从服务器序号 - 'slave_no' => '', + 'slave_no' => '', // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 是否需要进行SQL性能分析 - 'sql_explain' => false, + 'fields_strict' => true, // 是否需要断线重连 - 'break_reconnect' => false, + 'break_reconnect' => false, + // 字段缓存路径 + 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, ], // 更多的数据库配置信息 -- Gitee From 6f58df50c18bb4e2395d2908d7580ce1322d23fa Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 27 Aug 2019 13:11:02 +0800 Subject: [PATCH 149/186] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/BaseController.php | 9 --------- app/ExceptionHandle.php | 10 ---------- app/Request.php | 11 +---------- app/common.php | 10 ---------- app/event.php | 10 ---------- app/middleware.php | 2 +- app/provider.php | 10 ---------- config/app.php | 10 ---------- config/cache.php | 9 --------- config/console.php | 10 ---------- config/cookie.php | 10 ---------- config/database.php | 10 ---------- config/lang.php | 10 ---------- config/log.php | 9 --------- config/route.php | 12 +----------- config/session.php | 10 ---------- config/trace.php | 10 ---------- public/index.php | 2 +- public/router.php | 2 +- think | 11 +---------- 20 files changed, 6 insertions(+), 171 deletions(-) diff --git a/app/BaseController.php b/app/BaseController.php index 1356436..b3bd7d3 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -1,13 +1,4 @@ -// +---------------------------------------------------------------------- declare (strict_types = 1); namespace app; diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php index 375e841..453d126 100644 --- a/app/ExceptionHandle.php +++ b/app/ExceptionHandle.php @@ -1,14 +1,4 @@ -// +---------------------------------------------------------------------- - namespace app; use think\db\exception\DataNotFoundException; diff --git a/app/Request.php b/app/Request.php index bf830dc..fc9aba0 100644 --- a/app/Request.php +++ b/app/Request.php @@ -1,16 +1,7 @@ -// +---------------------------------------------------------------------- - namespace app; +// 应用请求对象类 class Request extends \think\Request { diff --git a/app/common.php b/app/common.php index 55d22f2..57cb6d8 100644 --- a/app/common.php +++ b/app/common.php @@ -1,12 +1,2 @@ -// +---------------------------------------------------------------------- - // 应用公共文件 diff --git a/app/event.php b/app/event.php index 26ba7eb..e9851bb 100644 --- a/app/event.php +++ b/app/event.php @@ -1,14 +1,4 @@ -// +---------------------------------------------------------------------- - // 事件定义文件 return [ 'bind' => [ diff --git a/app/middleware.php b/app/middleware.php index e599093..33d7329 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -1,5 +1,5 @@ -// +---------------------------------------------------------------------- - use app\ExceptionHandle; use app\Request; diff --git a/config/app.php b/config/app.php index 51b737c..c0059c3 100644 --- a/config/app.php +++ b/config/app.php @@ -1,14 +1,4 @@ -// +---------------------------------------------------------------------- - // +---------------------------------------------------------------------- // | 应用设置 // +---------------------------------------------------------------------- diff --git a/config/cache.php b/config/cache.php index dc54123..dd492df 100644 --- a/config/cache.php +++ b/config/cache.php @@ -1,13 +1,4 @@ -// +---------------------------------------------------------------------- use think\facade\Env; // +---------------------------------------------------------------------- diff --git a/config/console.php b/config/console.php index 27b516e..a818a98 100644 --- a/config/console.php +++ b/config/console.php @@ -1,14 +1,4 @@ -// +---------------------------------------------------------------------- - // +---------------------------------------------------------------------- // | 控制台配置 // +---------------------------------------------------------------------- diff --git a/config/cookie.php b/config/cookie.php index bbc5819..f728024 100644 --- a/config/cookie.php +++ b/config/cookie.php @@ -1,14 +1,4 @@ -// +---------------------------------------------------------------------- - // +---------------------------------------------------------------------- // | Cookie设置 // +---------------------------------------------------------------------- diff --git a/config/database.php b/config/database.php index d53f952..01128ba 100644 --- a/config/database.php +++ b/config/database.php @@ -1,14 +1,4 @@ -// +---------------------------------------------------------------------- - use think\facade\Env; return [ diff --git a/config/lang.php b/config/lang.php index 7659eaa..33232bd 100644 --- a/config/lang.php +++ b/config/lang.php @@ -1,14 +1,4 @@ -// +---------------------------------------------------------------------- - // +---------------------------------------------------------------------- // | 多语言设置 // +---------------------------------------------------------------------- diff --git a/config/log.php b/config/log.php index 493234a..5f7afcb 100644 --- a/config/log.php +++ b/config/log.php @@ -1,13 +1,4 @@ -// +---------------------------------------------------------------------- use think\facade\Env; // +---------------------------------------------------------------------- diff --git a/config/route.php b/config/route.php index 0b0e592..288c8f1 100644 --- a/config/route.php +++ b/config/route.php @@ -1,16 +1,6 @@ -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 应用设置 +// | 路由设置 // +---------------------------------------------------------------------- return [ diff --git a/config/session.php b/config/session.php index 7a2527a..7abf056 100644 --- a/config/session.php +++ b/config/session.php @@ -1,14 +1,4 @@ -// +---------------------------------------------------------------------- - // +---------------------------------------------------------------------- // | 会话设置 // +---------------------------------------------------------------------- diff --git a/config/trace.php b/config/trace.php index e268f3a..52211ec 100644 --- a/config/trace.php +++ b/config/trace.php @@ -1,14 +1,4 @@ -// +---------------------------------------------------------------------- - // +---------------------------------------------------------------------- // | Trace设置 开启调试模式后有效 // +---------------------------------------------------------------------- diff --git a/public/index.php b/public/index.php index e67b8d6..e3c0fe9 100644 --- a/public/index.php +++ b/public/index.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/public/router.php b/public/router.php index 4f916b4..ac7b3c8 100644 --- a/public/router.php +++ b/public/router.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/think b/think index b7e9aa4..2429d22 100644 --- a/think +++ b/think @@ -1,17 +1,8 @@ #!/usr/bin/env php -// +---------------------------------------------------------------------- - namespace think; +// 命令行入口文件 // 加载基础文件 require __DIR__ . '/vendor/autoload.php'; -- Gitee From f42e125db63cfdba6f8ddd26e7e0da66fb120448 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 9 Sep 2019 21:37:01 +0800 Subject: [PATCH 150/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6view.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/view.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 config/view.php diff --git a/config/view.php b/config/view.php new file mode 100644 index 0000000..51a4211 --- /dev/null +++ b/config/view.php @@ -0,0 +1,27 @@ + 'Think', + // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 + 'auto_rule' => 1, + // 模板基础路径 + 'view_base' => '', + // 模板路径 + 'view_path' => '', + // 模板后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 模板引擎普通标签开始标记 + 'tpl_begin' => '{', + // 模板引擎普通标签结束标记 + 'tpl_end' => '}', + // 标签库标签开始标记 + 'taglib_begin' => '{', + // 标签库标签结束标记 + 'taglib_end' => '}', +]; -- Gitee From 63b96a80465013a4859132f88251166be26b51b2 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 10 Sep 2019 23:01:31 +0800 Subject: [PATCH 151/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/view.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/config/view.php b/config/view.php index 51a4211..469eb64 100644 --- a/config/view.php +++ b/config/view.php @@ -5,23 +5,23 @@ return [ // 模板引擎类型使用Think - 'type' => 'Think', + 'type' => 'Think', // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 模板基础路径 - 'view_base' => '', + 'auto_rule' => 1, + // 模板目录名 + 'view_dir_name' => 'view', // 模板路径 - 'view_path' => '', + 'view_path' => '', // 模板后缀 - 'view_suffix' => 'html', + 'view_suffix' => 'html', // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, + 'view_depr' => DIRECTORY_SEPARATOR, // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', + 'tpl_begin' => '{', // 模板引擎普通标签结束标记 - 'tpl_end' => '}', + 'tpl_end' => '}', // 标签库标签开始标记 - 'taglib_begin' => '{', + 'taglib_begin' => '{', // 标签库标签结束标记 - 'taglib_end' => '}', + 'taglib_end' => '}', ]; -- Gitee From 6c53dae9d7ec5cae45dd92a64b168ee2649945e1 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Wed, 11 Sep 2019 10:22:03 +0800 Subject: [PATCH 152/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/session.php b/config/session.php index 7abf056..c92aef9 100644 --- a/config/session.php +++ b/config/session.php @@ -5,7 +5,7 @@ return [ // session name - 'name' => '', + 'name' => 'PHPSESSID', // SESSION_ID的提交变量,解决flash上传跨域 'var_session_id' => '', // 驱动方式 支持file redis memcache memcached -- Gitee From aee3e464e8b44c4256f30a636aba249be103b7fc Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Wed, 11 Sep 2019 11:01:40 +0800 Subject: [PATCH 153/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/session.php b/config/session.php index c92aef9..7dfd326 100644 --- a/config/session.php +++ b/config/session.php @@ -11,7 +11,7 @@ return [ // 驱动方式 支持file redis memcache memcached 'type' => 'file', // 过期时间 - 'expire' => 0, + 'expire' => 1440, // 前缀 'prefix' => '', ]; -- Gitee From 40cbc072bd4aeb9190253133cccd86a3988e2972 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 11 Sep 2019 11:35:25 +0800 Subject: [PATCH 154/186] =?UTF-8?q?session=E9=85=8D=E7=BD=AE=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/session.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/session.php b/config/session.php index 7dfd326..c1ef6e1 100644 --- a/config/session.php +++ b/config/session.php @@ -8,8 +8,10 @@ return [ 'name' => 'PHPSESSID', // SESSION_ID的提交变量,解决flash上传跨域 'var_session_id' => '', - // 驱动方式 支持file redis memcache memcached + // 驱动方式 支持file cache 'type' => 'file', + // 存储连接标识 当type使用cache的时候有效 + 'store' => null, // 过期时间 'expire' => 1440, // 前缀 -- Gitee From 83141cacf8444224ca182a49499889935262b6b2 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Thu, 12 Sep 2019 14:19:47 +0800 Subject: [PATCH 155/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=AD=E9=97=B4?= =?UTF-8?q?=E4=BB=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/middleware.php | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 config/middleware.php diff --git a/config/middleware.php b/config/middleware.php new file mode 100644 index 0000000..ce50837 --- /dev/null +++ b/config/middleware.php @@ -0,0 +1,8 @@ + [], + //优先级设置,此数组中的中间件会按照数组中的顺序优先执行 + 'priority' => [], +]; -- Gitee From 644f3067a24d68d182bc57c75614b9dfedb9df4b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 20 Sep 2019 10:59:11 +0800 Subject: [PATCH 156/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 7 +++++-- config/middleware.php | 8 ++++++++ config/view.php | 2 -- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 config/middleware.php diff --git a/config/database.php b/config/database.php index 01128ba..5b667dc 100644 --- a/config/database.php +++ b/config/database.php @@ -37,8 +37,7 @@ return [ 'charset' => Env::get('database.charset', 'utf8'), // 数据库表前缀 'prefix' => Env::get('database.prefix', ''), - // 数据库调试模式 - 'debug' => Env::get('database.debug', true), + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 'deploy' => 0, // 数据库读写是否分离 主从式有效 @@ -51,6 +50,10 @@ return [ 'fields_strict' => true, // 是否需要断线重连 'break_reconnect' => false, + // 监听SQL + 'trigger_sql' => true, + // 开启字段缓存 + 'fields_cache' => false, // 字段缓存路径 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, ], diff --git a/config/middleware.php b/config/middleware.php new file mode 100644 index 0000000..3953648 --- /dev/null +++ b/config/middleware.php @@ -0,0 +1,8 @@ + [], + // 中间件执行优先级 + 'priority' => [], +]; diff --git a/config/view.php b/config/view.php index 469eb64..01259a0 100644 --- a/config/view.php +++ b/config/view.php @@ -10,8 +10,6 @@ return [ 'auto_rule' => 1, // 模板目录名 'view_dir_name' => 'view', - // 模板路径 - 'view_path' => '', // 模板后缀 'view_suffix' => 'html', // 模板文件名分隔符 -- Gitee From b5b58e6a2c940e6a8663ad32133e54ccc012616f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E6=96=87=E5=81=A5?= Date: Tue, 24 Sep 2019 09:49:42 +0800 Subject: [PATCH 157/186] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/filesystem.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/filesystem.php b/config/filesystem.php index b6a0c5c..c851aed 100644 --- a/config/filesystem.php +++ b/config/filesystem.php @@ -3,16 +3,22 @@ use think\facade\Env; return [ + // 默认磁盘 'default' => Env::get('filesystem.driver', 'local'), + // 磁盘列表 'disks' => [ 'local' => [ 'type' => 'local', 'root' => app()->getRuntimePath() . 'storage', ], 'public' => [ + // 磁盘类型 'type' => 'local', + // 磁盘路径 'root' => app()->getRootPath() . 'public/storage', + // 磁盘路径对应的外部URL路径 'url' => '/storage', + // 可见性 'visibility' => 'public', ], // 更多的磁盘配置信息 -- Gitee From fe7b3e8bd1801f3f3338c388a98c7851134e2add Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 2 Oct 2019 21:18:20 +0800 Subject: [PATCH 158/186] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=AE=89=E8=A3=85thi?= =?UTF-8?q?nk-trace=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 ++- config/trace.php | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 config/trace.php diff --git a/composer.json b/composer.json index 44a2554..b671267 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "topthink/think-view": "^1.0" }, "require-dev": { - "symfony/var-dumper": "^4.2" + "symfony/var-dumper": "^4.2", + "topthink/think-trace":"^1.0" }, "autoload": { "psr-4": { diff --git a/config/trace.php b/config/trace.php deleted file mode 100644 index 52211ec..0000000 --- a/config/trace.php +++ /dev/null @@ -1,10 +0,0 @@ - 'Html', - // 读取的日志通道名 - 'channel' => '', -]; -- Gitee From 3785d4b4deeaf4b93307cfd735cd2abeeaf17868 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 2 Oct 2019 21:18:53 +0800 Subject: [PATCH 159/186] =?UTF-8?q?=E5=85=A8=E5=B1=80=E4=B8=AD=E9=97=B4?= =?UTF-8?q?=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/middleware.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/middleware.php b/app/middleware.php index 33d7329..d2c3fda 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -6,7 +6,5 @@ return [ // 多语言加载 // \think\middleware\LoadLangPack::class, // Session初始化 - // \think\middleware\SessionInit::class, - // 页面Trace调试 - // \think\middleware\TraceDebug::class, + // \think\middleware\SessionInit::class ]; -- Gitee From 5c268798c460b6f0e4e3aa7de1a9b3967627fe07 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 7 Oct 2019 14:15:23 +0800 Subject: [PATCH 160/186] =?UTF-8?q?app=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/config/app.php b/config/app.php index c0059c3..3bba167 100644 --- a/config/app.php +++ b/config/app.php @@ -14,18 +14,17 @@ return [ 'with_route' => true, // 是否启用事件 'with_event' => true, - // 自动多应用模式 - 'auto_multi_app' => false, + // 默认应用 + 'default_app' => 'index', + // 默认时区 + 'default_timezone' => 'Asia/Shanghai', + // 应用映射(自动多应用模式有效) 'app_map' => [], // 域名绑定(自动多应用模式有效) 'domain_bind' => [], // 禁止URL访问的应用列表(自动多应用模式有效) 'deny_app_list' => [], - // 默认应用 - 'default_app' => 'index', - // 默认时区 - 'default_timezone' => 'Asia/Shanghai', // 异常页面的模板文件 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', -- Gitee From 3a83c68e449e6c52ee090683b945a24bce534b68 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 14 Oct 2019 22:55:09 +0800 Subject: [PATCH 161/186] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E6=A8=A1=E6=9D=BF=E5=BC=95=E6=93=8E=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b671267..cf1e9f7 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,7 @@ "require": { "php": ">=7.1.0", "topthink/framework": "6.0.*-dev", - "topthink/think-orm": "2.0.*-dev", - "topthink/think-view": "^1.0" + "topthink/think-orm": "2.0.*-dev" }, "require-dev": { "symfony/var-dumper": "^4.2", -- Gitee From def1997c7f36d2cf4f91aa5a991ca30a8984d252 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 21 Oct 2019 22:03:01 +0800 Subject: [PATCH 162/186] =?UTF-8?q?=E5=88=A0=E9=99=A4build.example?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.example.php | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 build.example.php diff --git a/build.example.php b/build.example.php deleted file mode 100644 index 0f2222f..0000000 --- a/build.example.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -/** - * php think build 自动生成应用的目录结构的定义示例 - */ -return [ - // 需要自动创建的文件 - '__file__' => [], - // 需要自动创建的目录 - '__dir__' => ['controller', 'model', 'view'], - // 需要自动创建的控制器 - 'controller' => ['Index'], - // 需要自动创建的模型 - 'model' => ['User'], - // 需要自动创建的模板 - 'view' => ['index/index'], -]; -- Gitee From 115e2f3dc9c8e41b250f0348aa793d9477ea62d4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 23 Oct 2019 17:53:55 +0800 Subject: [PATCH 163/186] =?UTF-8?q?=E5=8F=96=E6=B6=88=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/route.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/config/route.php b/config/route.php index 288c8f1..955eeec 100644 --- a/config/route.php +++ b/config/route.php @@ -18,12 +18,6 @@ return [ 'route_rule_merge' => false, // 路由是否完全匹配 'route_complete_match' => false, - // 是否开启路由缓存 - 'route_check_cache' => false, - // 路由缓存连接参数 - 'route_cache_option' => [], - // 路由缓存Key - 'route_check_cache_key' => '', // 访问控制器层名称 'controller_layer' => 'controller', // 空控制器名 -- Gitee From 024e233ccbbd801240f69632b48c9f6f3dafefbf Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 24 Oct 2019 10:07:36 +0800 Subject: [PATCH 164/186] =?UTF-8?q?composer.json=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cf1e9f7..55ea747 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,8 @@ ], "require": { "php": ">=7.1.0", - "topthink/framework": "6.0.*-dev", - "topthink/think-orm": "2.0.*-dev" + "topthink/framework": "^6.0.0", + "topthink/think-orm": "^2.0" }, "require-dev": { "symfony/var-dumper": "^4.2", -- Gitee From 786386e32ea4e937ce130e226a1ae5850248bd2b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 29 Oct 2019 11:11:24 +0800 Subject: [PATCH 165/186] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=86=85=E7=BD=AEweb?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=AF=B9=E5=A4=9A=E7=BA=A7=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8=E8=AE=BF=E9=97=AE=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/router.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/router.php b/public/router.php index ac7b3c8..67fa82e 100644 --- a/public/router.php +++ b/public/router.php @@ -13,5 +13,9 @@ if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) { return false; } else { + if ($_SERVER["SCRIPT_NAME"] == $_SERVER["REQUEST_URI"]) { + $_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php'; + } + require __DIR__ . "/index.php"; } -- Gitee From 3f20049d876cb37f636ce9998e2c11cdde298cfe Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 29 Oct 2019 12:28:41 +0800 Subject: [PATCH 166/186] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/router.php b/public/router.php index 67fa82e..fb874c6 100644 --- a/public/router.php +++ b/public/router.php @@ -13,7 +13,7 @@ if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) { return false; } else { - if ($_SERVER["SCRIPT_NAME"] == $_SERVER["REQUEST_URI"]) { + if (0 === strpos($_SERVER["REQUEST_URI"], $_SERVER["SCRIPT_NAME"])) { $_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php'; } -- Gitee From 8f17a5cc805af03fa2aa3a788fa34487ed241856 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 29 Oct 2019 12:40:34 +0800 Subject: [PATCH 167/186] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/router.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/router.php b/public/router.php index fb874c6..9b39a62 100644 --- a/public/router.php +++ b/public/router.php @@ -13,9 +13,7 @@ if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) { return false; } else { - if (0 === strpos($_SERVER["REQUEST_URI"], $_SERVER["SCRIPT_NAME"])) { - $_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php'; - } + $_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php'; require __DIR__ . "/index.php"; } -- Gitee From 72c953db1e5ca4d512962d2ef1e7326ed1cc6cf8 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 7 Nov 2019 12:00:59 +0800 Subject: [PATCH 168/186] =?UTF-8?q?SQL=E7=9B=91=E5=90=AC=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/config/database.php b/config/database.php index 5b667dc..7b94ac1 100644 --- a/config/database.php +++ b/config/database.php @@ -1,9 +1,8 @@ Env::get('database.driver', 'mysql'), + 'default' => env('database.driver', 'mysql'), // 自定义时间查询规则 'time_query_rule' => [], @@ -20,23 +19,23 @@ return [ 'connections' => [ 'mysql' => [ // 数据库类型 - 'type' => Env::get('database.type', 'mysql'), + 'type' => env('database.type', 'mysql'), // 服务器地址 - 'hostname' => Env::get('database.hostname', '127.0.0.1'), + 'hostname' => env('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => Env::get('database.database', ''), + 'database' => env('database.database', ''), // 用户名 - 'username' => Env::get('database.username', 'root'), + 'username' => env('database.username', 'root'), // 密码 - 'password' => Env::get('database.password', ''), + 'password' => env('database.password', ''), // 端口 - 'hostport' => Env::get('database.hostport', '3306'), + 'hostport' => env('database.hostport', '3306'), // 数据库连接参数 'params' => [], // 数据库编码默认采用utf8 - 'charset' => Env::get('database.charset', 'utf8'), + 'charset' => env('database.charset', 'utf8'), // 数据库表前缀 - 'prefix' => Env::get('database.prefix', ''), + 'prefix' => env('database.prefix', ''), // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 'deploy' => 0, @@ -51,7 +50,7 @@ return [ // 是否需要断线重连 'break_reconnect' => false, // 监听SQL - 'trigger_sql' => true, + 'trigger_sql' => env('app_debug', true), // 开启字段缓存 'fields_cache' => false, // 字段缓存路径 -- Gitee From 2938ab058e7a82601be918d2e39f431ae596e0cc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 7 Nov 2019 12:03:26 +0800 Subject: [PATCH 169/186] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 4 +--- config/cache.php | 3 +-- config/filesystem.php | 4 +--- config/lang.php | 4 +--- config/log.php | 3 +-- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/config/app.php b/config/app.php index 3bba167..1cfaf5c 100644 --- a/config/app.php +++ b/config/app.php @@ -3,11 +3,9 @@ // | 应用设置 // +---------------------------------------------------------------------- -use think\facade\Env; - return [ // 应用地址 - 'app_host' => Env::get('app.host', ''), + 'app_host' => env('app.host', ''), // 应用的命名空间 'app_namespace' => '', // 是否启用路由 diff --git a/config/cache.php b/config/cache.php index dd492df..a8d69d2 100644 --- a/config/cache.php +++ b/config/cache.php @@ -1,5 +1,4 @@ Env::get('cache.driver', 'file'), + 'default' => env('cache.driver', 'file'), // 缓存连接方式配置 'stores' => [ diff --git a/config/filesystem.php b/config/filesystem.php index c851aed..965297e 100644 --- a/config/filesystem.php +++ b/config/filesystem.php @@ -1,10 +1,8 @@ Env::get('filesystem.driver', 'local'), + 'default' => env('filesystem.driver', 'local'), // 磁盘列表 'disks' => [ 'local' => [ diff --git a/config/lang.php b/config/lang.php index 33232bd..e3b4986 100644 --- a/config/lang.php +++ b/config/lang.php @@ -3,11 +3,9 @@ // | 多语言设置 // +---------------------------------------------------------------------- -use think\facade\Env; - return [ // 默认语言 - 'default_lang' => Env::get('lang.default_lang', 'zh-cn'), + 'default_lang' => env('lang.default_lang', 'zh-cn'), // 允许的语言列表 'allow_lang_list' => [], // 多语言自动侦测变量名 diff --git a/config/log.php b/config/log.php index 5f7afcb..ea24ff9 100644 --- a/config/log.php +++ b/config/log.php @@ -1,12 +1,11 @@ Env::get('log.channel', 'file'), + 'default' => env('log.channel', 'file'), // 日志记录级别 'level' => [], // 日志类型记录的通道 ['error'=>'email',...] -- Gitee From e59342777d61a2db7800713ac8a9ac1e09871a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B3=96=E6=8B=8C=E7=B1=B3=E9=A5=AD=E7=81=AC?= <100103431@qq.com> Date: Sun, 17 Nov 2019 21:03:50 +0800 Subject: [PATCH 170/186] =?UTF-8?q?=E6=9B=BF=E6=8D=A2list=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/BaseController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/BaseController.php b/app/BaseController.php index b3bd7d3..085680e 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -72,7 +72,7 @@ abstract class BaseController } else { if (strpos($validate, '.')) { // 支持场景 - list($validate, $scene) = explode('.', $validate); + [$validate, $scene] = explode('.', $validate); } $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); $v = new $class(); -- Gitee From 493a3d0596a18fd78a0f6ada3ae623508d3da4e8 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 18 Dec 2019 15:10:08 +0800 Subject: [PATCH 171/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0AppBootService?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=B1=BB=20=E4=BE=BF=E4=BA=8E=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/AppBootService.php | 15 +++++++++++++++ app/service.php | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 app/AppBootService.php create mode 100644 app/service.php diff --git a/app/AppBootService.php b/app/AppBootService.php new file mode 100644 index 0000000..d54a9b7 --- /dev/null +++ b/app/AppBootService.php @@ -0,0 +1,15 @@ + Date: Thu, 19 Dec 2019 17:08:09 +0800 Subject: [PATCH 172/186] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/AppBootService.php | 15 --------------- app/AppService.php | 22 ++++++++++++++++++++++ app/service.php | 4 ++-- 3 files changed, 24 insertions(+), 17 deletions(-) delete mode 100644 app/AppBootService.php create mode 100644 app/AppService.php diff --git a/app/AppBootService.php b/app/AppBootService.php deleted file mode 100644 index d54a9b7..0000000 --- a/app/AppBootService.php +++ /dev/null @@ -1,15 +0,0 @@ - Date: Tue, 21 Jan 2020 18:20:07 +0800 Subject: [PATCH 173/186] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 104 +++++++++++++++++++-------------------- app/controller/Index.php | 34 ++++++------- composer.json | 92 +++++++++++++++++----------------- 3 files changed, 117 insertions(+), 113 deletions(-) diff --git a/README.md b/README.md index 34e0e3e..e099327 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,52 @@ -ThinkPHP 6.0 -=============== - -> 运行环境要求PHP7.1+。 - -## 主要新特性 - -* 采用`PHP7`强类型(严格模式) -* 支持更多的`PSR`规范 -* 原生多应用支持 -* 更强大和易用的查询 -* 全新的事件系统 -* 模型事件和数据库事件统一纳入事件系统 -* 模板引擎分离出核心 -* 内部功能中间件化 -* SESSION/Cookie机制改进 -* 对Swoole以及协程支持改进 -* 对IDE更加友好 -* 统一和精简大量用法 - -## 安装 - -~~~ -composer create-project topthink/think tp 6.0.*-dev -~~~ - -如果需要更新框架使用 -~~~ -composer update topthink/framework -~~~ - -## 文档 - -[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content) - -## 参与开发 - -请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。 - -## 版权信息 - -ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 - -本项目包含的第三方源码和二进制文件之版权信息另行标注。 - -版权所有Copyright © 2006-2019 by ThinkPHP (http://thinkphp.cn) - -All rights reserved。 - -ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 - -更多细节参阅 [LICENSE.txt](LICENSE.txt) +ThinkPHP 6.0 +=============== + +> 运行环境要求PHP7.1+。 + +## 主要新特性 + +* 采用`PHP7`强类型(严格模式) +* 支持更多的`PSR`规范 +* 原生多应用支持 +* 更强大和易用的查询 +* 全新的事件系统 +* 模型事件和数据库事件统一纳入事件系统 +* 模板引擎分离出核心 +* 内部功能中间件化 +* SESSION/Cookie机制改进 +* 对Swoole以及协程支持改进 +* 对IDE更加友好 +* 统一和精简大量用法 + +## 安装 + +~~~ +composer create-project topthink/think tp 6.0.* +~~~ + +如果需要更新框架使用 +~~~ +composer update topthink/framework +~~~ + +## 文档 + +[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content) + +## 参与开发 + +请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。 + +## 版权信息 + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 + +本项目包含的第三方源码和二进制文件之版权信息另行标注。 + +版权所有Copyright © 2006-2020 by ThinkPHP (http://thinkphp.cn) + +All rights reserved。 + +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +更多细节参阅 [LICENSE.txt](LICENSE.txt) diff --git a/app/controller/Index.php b/app/controller/Index.php index d5563b6..fde840a 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -1,17 +1,17 @@ -*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:)

ThinkPHP V6
13载初心不改 - 你值得信赖的PHP框架

'; - } - - public function hello($name = 'ThinkPHP6') - { - return 'hello,' . $name; - } -} +*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:) 2020新春快乐

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; + } + + public function hello($name = 'ThinkPHP6') + { + return 'hello,' . $name; + } +} diff --git a/composer.json b/composer.json index 55ea747..387c8b6 100644 --- a/composer.json +++ b/composer.json @@ -1,44 +1,48 @@ -{ - "name": "topthink/think", - "description": "the new thinkphp framework", - "type": "project", - "keywords": [ - "framework", - "thinkphp", - "ORM" - ], - "homepage": "http://thinkphp.cn/", - "license": "Apache-2.0", - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "require": { - "php": ">=7.1.0", - "topthink/framework": "^6.0.0", - "topthink/think-orm": "^2.0" - }, - "require-dev": { - "symfony/var-dumper": "^4.2", - "topthink/think-trace":"^1.0" - }, - "autoload": { - "psr-4": { - "app\\": "app" - }, - "psr-0": { - "": "extend/" - } - }, - "config": { - "preferred-install": "dist" - }, - "scripts": { - "post-autoload-dump": [ - "@php think service:discover", - "@php think vendor:publish" - ] - } -} +{ + "name": "topthink/think", + "description": "the new thinkphp framework", + "type": "project", + "keywords": [ + "framework", + "thinkphp", + "ORM" + ], + "homepage": "http://thinkphp.cn/", + "license": "Apache-2.0", + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + }, + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "require": { + "php": ">=7.1.0", + "topthink/framework": "^6.0.0", + "topthink/think-orm": "^2.0" + }, + "require-dev": { + "symfony/var-dumper": "^4.2", + "topthink/think-trace":"^1.0" + }, + "autoload": { + "psr-4": { + "app\\": "app" + }, + "psr-0": { + "": "extend/" + } + }, + "config": { + "preferred-install": "dist" + }, + "scripts": { + "post-autoload-dump": [ + "@php think service:discover", + "@php think vendor:publish" + ] + } +} -- Gitee From 1f82ba2572452d22dd1c82fa52cfe7c8e5ebed09 Mon Sep 17 00:00:00 2001 From: ThinkPHP Date: Tue, 21 Jan 2020 10:20:50 +0000 Subject: [PATCH 174/186] Apply fixes from StyleCI --- app/controller/Index.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/controller/Index.php b/app/controller/Index.php index fde840a..a0c83ce 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -1,17 +1,17 @@ -*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:) 2020新春快乐

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; - } - - public function hello($name = 'ThinkPHP6') - { - return 'hello,' . $name; - } -} +*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:) 2020新春快乐

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; + } + + public function hello($name = 'ThinkPHP6') + { + return 'hello,' . $name; + } +} -- Gitee From 8fde38c52f81bac5b581525942df5e4a64ac34d1 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 22 Jan 2020 11:55:09 +0800 Subject: [PATCH 175/186] =?UTF-8?q?readme=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e099327..487f26f 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ ThinkPHP 6.0 > 运行环境要求PHP7.1+。 +ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。 + ## 主要新特性 * 采用`PHP7`强类型(严格模式) -- Gitee From bc817630d2e898384df3b94247fb48890b45a84b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 1 Mar 2020 21:33:37 +0800 Subject: [PATCH 176/186] =?UTF-8?q?=E5=BA=9F=E5=BC=83with=5Fevent=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.php | 66 ++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/config/app.php b/config/app.php index 1cfaf5c..4da285e 100644 --- a/config/app.php +++ b/config/app.php @@ -1,34 +1,32 @@ - env('app.host', ''), - // 应用的命名空间 - 'app_namespace' => '', - // 是否启用路由 - 'with_route' => true, - // 是否启用事件 - 'with_event' => true, - // 默认应用 - 'default_app' => 'index', - // 默认时区 - 'default_timezone' => 'Asia/Shanghai', - - // 应用映射(自动多应用模式有效) - 'app_map' => [], - // 域名绑定(自动多应用模式有效) - 'domain_bind' => [], - // 禁止URL访问的应用列表(自动多应用模式有效) - 'deny_app_list' => [], - - // 异常页面的模板文件 - 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', - - // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', - // 显示错误信息 - 'show_error_msg' => false, -]; + env('app.host', ''), + // 应用的命名空间 + 'app_namespace' => '', + // 是否启用路由 + 'with_route' => true, + // 默认应用 + 'default_app' => 'index', + // 默认时区 + 'default_timezone' => 'Asia/Shanghai', + + // 应用映射(自动多应用模式有效) + 'app_map' => [], + // 域名绑定(自动多应用模式有效) + 'domain_bind' => [], + // 禁止URL访问的应用列表(自动多应用模式有效) + 'deny_app_list' => [], + + // 异常页面的模板文件 + 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', + + // 错误显示信息,非调试模式有效 + 'error_message' => '页面错误!请稍后再试~', + // 显示错误信息 + 'show_error_msg' => false, +]; -- Gitee From e2d97584c4cfa04d56312f548a47412c81e2069c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 2 Jun 2020 15:53:12 +0800 Subject: [PATCH 177/186] readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 487f26f..5ba84c9 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ ThinkPHP 6.0 > 运行环境要求PHP7.1+。 +[`ThinkPHP`应用服务市场上线](https://www.thinkphp.cn/service) +[![](https://e.topthink.com/api/item/685/pic)](https://www.thinkphp.cn/service) + ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。 ## 主要新特性 -- Gitee From 54aeca8fe2961996d4b21e3e984852c29519ca10 Mon Sep 17 00:00:00 2001 From: hongfs Date: Sun, 21 Jun 2020 16:21:00 +0800 Subject: [PATCH 178/186] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=BC=80=E5=90=AF=E8=AF=B7=E6=B1=82=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E9=94=AE=E5=90=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/route.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/route.php b/config/route.php index 955eeec..2f4cd12 100644 --- a/config/route.php +++ b/config/route.php @@ -27,7 +27,7 @@ return [ // 默认的路由变量规则 'default_route_pattern' => '[\w\.]+', // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, + 'request_cache_key' => false, // 请求缓存有效期 'request_cache_expire' => null, // 全局请求缓存排除规则 -- Gitee From 1d720907044d8bea8a2621b030400910611b27f6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 22 Jun 2020 09:48:59 +0800 Subject: [PATCH 179/186] readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 5ba84c9..236a622 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ ThinkPHP 6.0 > 运行环境要求PHP7.1+。 [`ThinkPHP`应用服务市场上线](https://www.thinkphp.cn/service) -[![](https://e.topthink.com/api/item/685/pic)](https://www.thinkphp.cn/service) ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。 -- Gitee From c7db66575ec136e3b74ef1ebca0e5d9e8df97069 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 24 Jun 2020 22:10:31 +0800 Subject: [PATCH 180/186] =?UTF-8?q?readme=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 236a622..5ec481e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ThinkPHP 6.0 > 运行环境要求PHP7.1+。 -[`ThinkPHP`应用服务市场上线](https://www.thinkphp.cn/service) +[官方应用服务市场](https://www.thinkphp.cn/service) | [`ThinkPHP`开发者扶持计划](https://sites.thinkphp.cn/1782366) ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。 -- Gitee From 8de1e3a96835dac4fe30ed7b6dee72c41d7769dc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 25 Jun 2020 00:05:52 +0800 Subject: [PATCH 181/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controller/Index.php b/app/controller/Index.php index a0c83ce..81203ad 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -7,7 +7,7 @@ class Index extends BaseController { public function index() { - return '

:) 2020新春快乐

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; + return '

:)

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; } public function hello($name = 'ThinkPHP6') -- Gitee From 120c9e6f7f54c28b67133a9cf01ed0ddcd671ea8 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 26 Jun 2020 23:07:55 +0800 Subject: [PATCH 182/186] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E8=AE=BE=E7=BD=AE=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/lang.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/lang.php b/config/lang.php index e3b4986..59f320f 100644 --- a/config/lang.php +++ b/config/lang.php @@ -14,6 +14,8 @@ return [ 'use_cookie' => true, // 多语言cookie变量 'cookie_var' => 'think_lang', + // 多语言header变量 + 'header_var' => 'think-lang', // 扩展语言包 'extend_list' => [], // Accept-Language转义为对应语言包名称 -- Gitee From 201df88ca4fbf5296da47dc802935da2f840c5d2 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 3 Sep 2020 17:50:56 +0800 Subject: [PATCH 183/186] =?UTF-8?q?readme=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ec481e..211bc9c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ThinkPHP 6.0 > 运行环境要求PHP7.1+。 -[官方应用服务市场](https://www.thinkphp.cn/service) | [`ThinkPHP`开发者扶持计划](https://sites.thinkphp.cn/1782366) +[官方应用服务市场](https://market.topthink.com) | [`ThinkPHP`开发者扶持计划](https://sites.thinkphp.cn/1782366) ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。 -- Gitee From 956b07a5cf47927600a1177d679fe102c49d9790 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 28 Sep 2020 17:08:46 +0800 Subject: [PATCH 184/186] =?UTF-8?q?=E5=8F=96=E6=B6=88schema=5Fcache=5Fpath?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/config/database.php b/config/database.php index 7b94ac1..290e009 100644 --- a/config/database.php +++ b/config/database.php @@ -19,42 +19,40 @@ return [ 'connections' => [ 'mysql' => [ // 数据库类型 - 'type' => env('database.type', 'mysql'), + 'type' => env('database.type', 'mysql'), // 服务器地址 - 'hostname' => env('database.hostname', '127.0.0.1'), + 'hostname' => env('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => env('database.database', ''), + 'database' => env('database.database', ''), // 用户名 - 'username' => env('database.username', 'root'), + 'username' => env('database.username', 'root'), // 密码 - 'password' => env('database.password', ''), + 'password' => env('database.password', ''), // 端口 - 'hostport' => env('database.hostport', '3306'), + 'hostport' => env('database.hostport', '3306'), // 数据库连接参数 - 'params' => [], + 'params' => [], // 数据库编码默认采用utf8 - 'charset' => env('database.charset', 'utf8'), + 'charset' => env('database.charset', 'utf8'), // 数据库表前缀 - 'prefix' => env('database.prefix', ''), + 'prefix' => env('database.prefix', ''), // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, + 'deploy' => 0, // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, + 'rw_separate' => false, // 读写分离后 主服务器数量 - 'master_num' => 1, + 'master_num' => 1, // 指定从服务器序号 - 'slave_no' => '', + 'slave_no' => '', // 是否严格检查字段是否存在 - 'fields_strict' => true, + 'fields_strict' => true, // 是否需要断线重连 - 'break_reconnect' => false, + 'break_reconnect' => false, // 监听SQL - 'trigger_sql' => env('app_debug', true), + 'trigger_sql' => env('app_debug', true), // 开启字段缓存 - 'fields_cache' => false, - // 字段缓存路径 - 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, + 'fields_cache' => false, ], // 更多的数据库配置信息 -- Gitee From 48b8b9d302042882ce9a0d48f43e6d4921490804 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 5 Nov 2020 11:57:22 +0800 Subject: [PATCH 185/186] =?UTF-8?q?=E6=9B=B4=E6=96=B0cookie=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cookie.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/cookie.php b/config/cookie.php index f728024..d3b3aab 100644 --- a/config/cookie.php +++ b/config/cookie.php @@ -15,4 +15,6 @@ return [ 'httponly' => false, // 是否使用 setcookie 'setcookie' => true, + // samesite 设置,支持 'strict' 'lax' + 'samesite' => '', ]; -- Gitee From 66d1794c4d2d12dc981788cd6e9b070b05d542f3 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 11 Jan 2021 10:39:21 +0800 Subject: [PATCH 186/186] =?UTF-8?q?readme=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 211bc9c..091b52f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ThinkPHP 6.0 =============== -> 运行环境要求PHP7.1+。 +> 运行环境要求PHP7.1+,兼容PHP8.0。 -[官方应用服务市场](https://market.topthink.com) | [`ThinkPHP`开发者扶持计划](https://sites.thinkphp.cn/1782366) +[官方应用服务市场](https://market.topthink.com) | [`ThinkAPI`——官方统一API服务](https://docs.topthink.com/think-api) ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。 -- Gitee