mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
merge
This commit is contained in:
@@ -1,16 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 应用设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
// 应用模式状态
|
// 应用模式状态
|
||||||
'app_status' => '',
|
'app_status' => '',
|
||||||
// PATHINFO变量名 用于兼容模式
|
|
||||||
'var_pathinfo' => 's',
|
|
||||||
// 兼容PATH_INFO获取
|
|
||||||
'pathinfo_fetch' => 'ORIG_PATH_INFO,REDIRECT_PATH_INFO,REDIRECT_URL',
|
|
||||||
// 扩展配置文件
|
// 扩展配置文件
|
||||||
'extra_config_list' => ['database', 'route'],
|
'extra_config_list' => ['database', 'route'],
|
||||||
// pathinfo分隔符
|
// 默认输出类型
|
||||||
'pathinfo_depr' => '/',
|
'default_return_type' => 'html',
|
||||||
|
// 默认语言
|
||||||
|
'default_lang' => 'zh-cn',
|
||||||
|
// 是否使用session
|
||||||
|
'use_session' => true,
|
||||||
|
// response输出终止执行
|
||||||
|
'response_exit' => true,
|
||||||
|
// 默认AJAX 数据返回格式,可选JSON XML ...
|
||||||
|
'default_ajax_return' => 'JSON',
|
||||||
|
// 默认JSONP格式返回的处理方法
|
||||||
|
'default_jsonp_handler' => 'jsonpReturn',
|
||||||
|
// 默认JSONP处理方法
|
||||||
|
'var_jsonp_handler' => 'callback',
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 模块设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
// 默认模块名
|
// 默认模块名
|
||||||
'default_module' => 'index',
|
'default_module' => 'index',
|
||||||
// 禁止访问模块
|
// 禁止访问模块
|
||||||
@@ -23,8 +40,19 @@ return [
|
|||||||
'empty_controller' => 'error',
|
'empty_controller' => 'error',
|
||||||
// 操作方法后缀
|
// 操作方法后缀
|
||||||
'action_suffix' => '',
|
'action_suffix' => '',
|
||||||
|
// 操作绑定到类
|
||||||
|
'action_bind_class' => false,
|
||||||
|
|
||||||
/* URL设置 */
|
// +----------------------------------------------------------------------
|
||||||
|
// | URL设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// PATHINFO变量名 用于兼容模式
|
||||||
|
'var_pathinfo' => 's',
|
||||||
|
// 兼容PATH_INFO获取
|
||||||
|
'pathinfo_fetch' => 'ORIG_PATH_INFO,REDIRECT_PATH_INFO,REDIRECT_URL',
|
||||||
|
// pathinfo分隔符
|
||||||
|
'pathinfo_depr' => '/',
|
||||||
// 获取当前页面地址的系统变量 默认为REQUEST_URI
|
// 获取当前页面地址的系统变量 默认为REQUEST_URI
|
||||||
'url_request_uri' => 'REQUEST_URI',
|
'url_request_uri' => 'REQUEST_URI',
|
||||||
// 基础URL路径
|
// 基础URL路径
|
||||||
@@ -37,27 +65,30 @@ return [
|
|||||||
'url_parmas_bind_type' => 0,
|
'url_parmas_bind_type' => 0,
|
||||||
//url地址的后缀
|
//url地址的后缀
|
||||||
'url_deny_suffix' => '',
|
'url_deny_suffix' => '',
|
||||||
//是否必须使用路由
|
// 是否开启路由
|
||||||
|
'url_route_on' => true,
|
||||||
|
// 是否强制使用路由
|
||||||
'url_route_must' => false,
|
'url_route_must' => false,
|
||||||
|
// URL模块映射
|
||||||
|
'url_module_map' => [],
|
||||||
|
|
||||||
// 默认输出类型
|
// 默认输出类型
|
||||||
'default_return_type' => 'html',
|
'default_return_type' => 'html',
|
||||||
// 默认语言
|
// 默认语言
|
||||||
'default_lang' => 'zh-cn',
|
'default_lang' => 'zh-cn',
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 视图及模板设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
// 默认跳转页面对应的模板文件
|
// 默认跳转页面对应的模板文件
|
||||||
'dispatch_jump_tmpl' => THINK_PATH . 'tpl/dispatch_jump.tpl',
|
'dispatch_jump_tmpl' => THINK_PATH . 'tpl/dispatch_jump.tpl',
|
||||||
// 默认AJAX 数据返回格式,可选JSON XML ...
|
// 默认的模板引擎
|
||||||
'default_ajax_return' => 'JSON',
|
|
||||||
// 默认JSONP格式返回的处理方法
|
|
||||||
'default_jsonp_handler' => 'jsonpReturn',
|
|
||||||
'var_jsonp_handler' => 'callback',
|
|
||||||
'template_engine' => 'think',
|
'template_engine' => 'think',
|
||||||
'action_bind_class' => false,
|
|
||||||
'url_module_map' => [],
|
|
||||||
'response_exit' => true,
|
|
||||||
|
|
||||||
/* 错误设置 */
|
// +----------------------------------------------------------------------
|
||||||
|
// | 异常及错误设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
// 异常页面的模板文件
|
// 异常页面的模板文件
|
||||||
'exception_tmpl' => THINK_PATH . 'tpl/think_exception.tpl',
|
'exception_tmpl' => THINK_PATH . 'tpl/think_exception.tpl',
|
||||||
// 错误显示信息,非调试模式有效
|
// 错误显示信息,非调试模式有效
|
||||||
@@ -67,11 +98,19 @@ return [
|
|||||||
// 显示错误信息
|
// 显示错误信息
|
||||||
'show_error_msg' => false,
|
'show_error_msg' => false,
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 日志设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
'log' => [
|
'log' => [
|
||||||
'type' => 'File',
|
'type' => 'File',
|
||||||
'path' => LOG_PATH,
|
'path' => LOG_PATH,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 缓存设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
'cache' => [
|
'cache' => [
|
||||||
'type' => 'File',
|
'type' => 'File',
|
||||||
'path' => CACHE_PATH,
|
'path' => CACHE_PATH,
|
||||||
@@ -81,6 +120,10 @@ return [
|
|||||||
// 是否使用session
|
// 是否使用session
|
||||||
'use_session' => true,
|
'use_session' => true,
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 会话设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
'session' => [
|
'session' => [
|
||||||
'id' => '',
|
'id' => '',
|
||||||
'prefix' => 'think',
|
'prefix' => 'think',
|
||||||
@@ -88,7 +131,10 @@ return [
|
|||||||
'auto_start' => true,
|
'auto_start' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
/* 数据库设置 */
|
// +----------------------------------------------------------------------
|
||||||
|
// | 数据库设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
'database' => [
|
'database' => [
|
||||||
// 数据库类型
|
// 数据库类型
|
||||||
'type' => 'mysql',
|
'type' => 'mysql',
|
||||||
@@ -121,7 +167,11 @@ return [
|
|||||||
// 指定从服务器序号
|
// 指定从服务器序号
|
||||||
'slave_no' => '',
|
'slave_no' => '',
|
||||||
],
|
],
|
||||||
/* SocketLog 调试 */
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | SocketLog设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
'slog' => [
|
'slog' => [
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
//是否显示利于优化的参数,如果允许时间,消耗内存等
|
//是否显示利于优化的参数,如果允许时间,消耗内存等
|
||||||
@@ -131,6 +181,6 @@ return [
|
|||||||
//日志强制记录到配置的client_id
|
//日志强制记录到配置的client_id
|
||||||
'force_client_id' => '',
|
'force_client_id' => '',
|
||||||
//限制允许读取日志的client_id
|
//限制允许读取日志的client_id
|
||||||
'allow_client_ids' => array(),
|
'allow_client_ids' => [],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class Cache
|
|||||||
public static function connect($options = [])
|
public static function connect($options = [])
|
||||||
{
|
{
|
||||||
$type = !empty($options['type']) ? $options['type'] : 'File';
|
$type = !empty($options['type']) ? $options['type'] : 'File';
|
||||||
$class = 'think\\cache\\driver\\' . strtolower($type);
|
$class = 'think\\cache\\driver\\' . ucwords($type);
|
||||||
self::$handler = new $class($options);
|
self::$handler = new $class($options);
|
||||||
return self::$handler;
|
return self::$handler;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class Config
|
|||||||
if (empty($type)) {
|
if (empty($type)) {
|
||||||
$type = substr(strrchr($config, '.'), 1);
|
$type = substr(strrchr($config, '.'), 1);
|
||||||
}
|
}
|
||||||
|
$range = $range ? $range : self::$range;
|
||||||
$class = '\\think\\config\\driver\\' . strtolower($type);
|
$class = '\\think\\config\\driver\\' . strtolower($type);
|
||||||
self::set((new $class())->parse($config), '', $range);
|
self::set((new $class())->parse($config), '', $range);
|
||||||
}
|
}
|
||||||
@@ -40,7 +41,8 @@ class Config
|
|||||||
// 加载配置文件
|
// 加载配置文件
|
||||||
public static function load($file, $name = '', $range = '')
|
public static function load($file, $name = '', $range = '')
|
||||||
{
|
{
|
||||||
$file = strpos($file, '.') ? $file : APP_PATH . $file . EXT;
|
$range = $range ? $range : self::$range;
|
||||||
|
$file = strpos($file, '.') ? $file : APP_PATH . $file . EXT;
|
||||||
if (!isset(self::$config[$range])) {
|
if (!isset(self::$config[$range])) {
|
||||||
self::$config[$range] = [];
|
self::$config[$range] = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Loader
|
|||||||
include self::$map[$class];
|
include self::$map[$class];
|
||||||
} else {
|
} else {
|
||||||
// 命名空间自动加载
|
// 命名空间自动加载
|
||||||
$name = strstr($class, '\\', true);
|
$name = strtolower(strstr($class, '\\', true));
|
||||||
if (isset(self::$namespace[$name])) {
|
if (isset(self::$namespace[$name])) {
|
||||||
// 注册的命名空间
|
// 注册的命名空间
|
||||||
$path = dirname(self::$namespace[$name]) . '/';
|
$path = dirname(self::$namespace[$name]) . '/';
|
||||||
@@ -246,7 +246,7 @@ class Loader
|
|||||||
if (class_exists($class)) {
|
if (class_exists($class)) {
|
||||||
$o = new $class();
|
$o = new $class();
|
||||||
if (!empty($method) && method_exists($o, $method)) {
|
if (!empty($method) && method_exists($o, $method)) {
|
||||||
$_instance[$identify] = call_user_func_array([ & $o, $method],[]);
|
$_instance[$identify] = call_user_func_array([ & $o, $method], []);
|
||||||
} else {
|
} else {
|
||||||
$_instance[$identify] = $o;
|
$_instance[$identify] = $o;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Log
|
|||||||
public static function init($config = [])
|
public static function init($config = [])
|
||||||
{
|
{
|
||||||
$type = isset($config['type']) ? $config['type'] : 'File';
|
$type = isset($config['type']) ? $config['type'] : 'File';
|
||||||
$class = '\\think\\log\\driver\\' . strtolower($type);
|
$class = '\\think\\log\\driver\\' . ucwords($type);
|
||||||
unset($config['type']);
|
unset($config['type']);
|
||||||
self::$storage = new $class($config);
|
self::$storage = new $class($config);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ namespace think;
|
|||||||
class Template
|
class Template
|
||||||
{
|
{
|
||||||
// 模板变量
|
// 模板变量
|
||||||
protected $data = [];
|
protected $data = [];
|
||||||
// 引擎配置
|
// 引擎配置
|
||||||
protected $config = [
|
protected $config = [
|
||||||
'tpl_path' => VIEW_PATH, // 模板路径
|
'tpl_path' => VIEW_PATH, // 模板路径
|
||||||
'tpl_suffix' => '.html', // 默认模板文件后缀
|
'tpl_suffix' => '.html', // 默认模板文件后缀
|
||||||
'cache_suffix' => '.php', // 默认模板缓存后缀
|
'cache_suffix' => '.php', // 默认模板缓存后缀
|
||||||
@@ -63,7 +63,7 @@ class Template
|
|||||||
|
|
||||||
// 初始化模板编译存储器
|
// 初始化模板编译存储器
|
||||||
$type = $this->config['compile_type'] ? $this->config['compile_type'] : 'File';
|
$type = $this->config['compile_type'] ? $this->config['compile_type'] : 'File';
|
||||||
$class = '\\think\\template\\driver\\' . strtolower($type);
|
$class = '\\think\\template\\driver\\' . ucwords($type);
|
||||||
$this->storage = new $class();
|
$this->storage = new $class();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -658,10 +658,10 @@ class Template
|
|||||||
//模板函数过滤
|
//模板函数过滤
|
||||||
$fun = strtolower(trim($args[0]));
|
$fun = strtolower(trim($args[0]));
|
||||||
switch ($fun) {
|
switch ($fun) {
|
||||||
case 'default': // 特殊模板函数
|
case 'default': // 特殊模板函数
|
||||||
$name = '(' . $name . ')?(' . $name . '):' . $args[1];
|
$name = '(' . $name . ')?(' . $name . '):' . $args[1];
|
||||||
break;
|
break;
|
||||||
default: // 通用模板函数
|
default: // 通用模板函数
|
||||||
if (!in_array($fun, $template_deny_funs)) {
|
if (!in_array($fun, $template_deny_funs)) {
|
||||||
if (isset($args[1])) {
|
if (isset($args[1])) {
|
||||||
if (strstr($args[1], '###')) {
|
if (strstr($args[1], '###')) {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class View
|
|||||||
* @param string $value 值
|
* @param string $value 值
|
||||||
* @return View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function config($config = '',$value='')
|
public function config($config = '', $value = '')
|
||||||
{
|
{
|
||||||
if (is_array($config)) {
|
if (is_array($config)) {
|
||||||
foreach ($this->config as $key => $val) {
|
foreach ($this->config as $key => $val) {
|
||||||
@@ -70,8 +70,8 @@ class View
|
|||||||
$this->config[$key] = $config[$key];
|
$this->config[$key] = $config[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$this->config[$config] = $value;
|
$this->config[$config] = $value;
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ class View
|
|||||||
*/
|
*/
|
||||||
public function engine($engine, array $config = [])
|
public function engine($engine, array $config = [])
|
||||||
{
|
{
|
||||||
$class = '\\think\\view\\driver\\' . strtolower($engine);
|
$class = '\\think\\view\\driver\\' . ucwords($engine);
|
||||||
$this->engine = new $class($config);
|
$this->engine = new $class($config);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,12 @@ return [
|
|||||||
'think\Log' => CORE_PATH . 'log' . EXT,
|
'think\Log' => CORE_PATH . 'log' . EXT,
|
||||||
'think\log\driver\File' => CORE_PATH . 'log' . DS . 'driver' . DS . 'file' . EXT,
|
'think\log\driver\File' => CORE_PATH . 'log' . DS . 'driver' . DS . 'file' . EXT,
|
||||||
'think\Config' => CORE_PATH . 'config' . EXT,
|
'think\Config' => CORE_PATH . 'config' . EXT,
|
||||||
|
'think\Create' => CORE_PATH . 'create' . EXT,
|
||||||
'think\Route' => CORE_PATH . 'route' . EXT,
|
'think\Route' => CORE_PATH . 'route' . EXT,
|
||||||
'think\Exception' => CORE_PATH . 'exception' . EXT,
|
'think\Exception' => CORE_PATH . 'exception' . EXT,
|
||||||
'think\Model' => CORE_PATH . 'model' . EXT,
|
'think\Model' => CORE_PATH . 'model' . EXT,
|
||||||
'think\Db' => CORE_PATH . 'db' . EXT,
|
'think\Db' => CORE_PATH . 'db' . EXT,
|
||||||
'think\Db\Driver' => CORE_PATH . 'db'.DS.'driver' . EXT,
|
'think\Db\Driver' => CORE_PATH . 'db' . DS . 'driver' . EXT,
|
||||||
'think\Template' => CORE_PATH . 'template' . EXT,
|
'think\Template' => CORE_PATH . 'template' . EXT,
|
||||||
'think\view\driver\Think' => CORE_PATH . 'view' . DS . 'driver' . DS . 'think' . EXT,
|
'think\view\driver\Think' => CORE_PATH . 'view' . DS . 'driver' . DS . 'think' . EXT,
|
||||||
'think\template\driver\File' => CORE_PATH . 'template' . DS . 'driver' . DS . 'file' . EXT,
|
'think\template\driver\File' => CORE_PATH . 'template' . DS . 'driver' . DS . 'file' . EXT,
|
||||||
@@ -42,7 +43,7 @@ return [
|
|||||||
'think\Url' => CORE_PATH . 'url' . EXT,
|
'think\Url' => CORE_PATH . 'url' . EXT,
|
||||||
'think\Debug' => CORE_PATH . 'debug' . EXT,
|
'think\Debug' => CORE_PATH . 'debug' . EXT,
|
||||||
'think\Input' => CORE_PATH . 'input' . EXT,
|
'think\Input' => CORE_PATH . 'input' . EXT,
|
||||||
'think\Lang' => CORE_PATH . 'lang' . EXT
|
'think\Lang' => CORE_PATH . 'lang' . EXT,
|
||||||
],
|
],
|
||||||
|
|
||||||
'init' => [],
|
'init' => [],
|
||||||
|
|||||||
Reference in New Issue
Block a user