内核更新
This commit is contained in:
@@ -144,6 +144,7 @@ class Base extends \think\Controller{
|
|||||||
defined('IS_POST') or define('IS_POST', $this->request->isPost());
|
defined('IS_POST') or define('IS_POST', $this->request->isPost());
|
||||||
defined('IS_GET') or define('IS_GET', $this->request->isGet());
|
defined('IS_GET') or define('IS_GET', $this->request->isGet());
|
||||||
$this->url = $this->request->module() . '/' . $this->request->controller() . '/' . $this->request->action();
|
$this->url = $this->request->module() . '/' . $this->request->controller() . '/' . $this->request->action();
|
||||||
|
$this->assign('request',$this->request);
|
||||||
$this->assign('param',$this->param);
|
$this->assign('param',$this->param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ return [
|
|||||||
'url_param_type' => 0,
|
'url_param_type' => 0,
|
||||||
// 是否开启路由
|
// 是否开启路由
|
||||||
'url_route_on' => true,
|
'url_route_on' => true,
|
||||||
|
// 路由配置文件(支持配置多个)
|
||||||
|
'route_config_file' => ['route'],
|
||||||
// 是否强制使用路由
|
// 是否强制使用路由
|
||||||
'url_route_must' => false,
|
'url_route_must' => false,
|
||||||
// 域名部署
|
// 域名部署
|
||||||
|
|||||||
@@ -483,13 +483,19 @@ class App
|
|||||||
if (is_array($rules)) {
|
if (is_array($rules)) {
|
||||||
Route::rules($rules);
|
Route::rules($rules);
|
||||||
}
|
}
|
||||||
} elseif (is_file(CONF_PATH . 'route' . CONF_EXT)) {
|
} else {
|
||||||
// 导入路由配置
|
$files = $config['route_config_file'];
|
||||||
$rules = include CONF_PATH . 'route' . CONF_EXT;
|
foreach ($files as $file) {
|
||||||
if (is_array($rules)) {
|
if (is_file(CONF_PATH . $file . CONF_EXT)) {
|
||||||
Route::import($rules);
|
// 导入路由配置
|
||||||
|
$rules = include CONF_PATH . $file . CONF_EXT;
|
||||||
|
if (is_array($rules)) {
|
||||||
|
Route::import($rules);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 路由检测(根据路由定义返回不同的URL调度)
|
// 路由检测(根据路由定义返回不同的URL调度)
|
||||||
$result = Route::check($request, $path, $depr, $config['url_domain_deploy']);
|
$result = Route::check($request, $path, $depr, $config['url_domain_deploy']);
|
||||||
$must = !is_null(self::$routeMust) ? self::$routeMust : $config['url_route_must'];
|
$must = !is_null(self::$routeMust) ? self::$routeMust : $config['url_route_must'];
|
||||||
|
|||||||
@@ -783,10 +783,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
/**
|
/**
|
||||||
* 删除当前的记录
|
* 删除当前的记录
|
||||||
* @access public
|
* @access public
|
||||||
* @param bool $force 是否强制删除
|
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function delete($force = false)
|
public function delete()
|
||||||
{
|
{
|
||||||
if (false === $this->trigger('before_delete', $this)) {
|
if (false === $this->trigger('before_delete', $this)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -68,47 +68,45 @@ abstract class Connection
|
|||||||
// 数据库连接参数配置
|
// 数据库连接参数配置
|
||||||
protected $config = [
|
protected $config = [
|
||||||
// 数据库类型
|
// 数据库类型
|
||||||
'type' => '',
|
'type' => '',
|
||||||
// 服务器地址
|
// 服务器地址
|
||||||
'hostname' => '',
|
'hostname' => '',
|
||||||
// 数据库名
|
// 数据库名
|
||||||
'database' => '',
|
'database' => '',
|
||||||
// 用户名
|
// 用户名
|
||||||
'username' => '',
|
'username' => '',
|
||||||
// 密码
|
// 密码
|
||||||
'password' => '',
|
'password' => '',
|
||||||
// 端口
|
// 端口
|
||||||
'hostport' => '',
|
'hostport' => '',
|
||||||
// 连接dsn
|
// 连接dsn
|
||||||
'dsn' => '',
|
'dsn' => '',
|
||||||
// 数据库连接参数
|
// 数据库连接参数
|
||||||
'params' => [],
|
'params' => [],
|
||||||
// 数据库编码默认采用utf8
|
// 数据库编码默认采用utf8
|
||||||
'charset' => 'utf8',
|
'charset' => 'utf8',
|
||||||
// 数据库表前缀
|
// 数据库表前缀
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
// 数据库调试模式
|
// 数据库调试模式
|
||||||
'debug' => false,
|
'debug' => false,
|
||||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
// 数据库部署方式: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,
|
||||||
// 数据集返回类型
|
// 数据集返回类型
|
||||||
'resultset_type' => 'array',
|
'resultset_type' => 'array',
|
||||||
// 自动写入时间戳字段
|
// 自动写入时间戳字段
|
||||||
'auto_timestamp' => false,
|
'auto_timestamp' => false,
|
||||||
// 是否需要进行SQL性能分析
|
// 是否需要进行SQL性能分析
|
||||||
'sql_explain' => false,
|
'sql_explain' => false,
|
||||||
// Builder类
|
// Builder类
|
||||||
'builder' => '',
|
'builder' => '',
|
||||||
// 软删除字段
|
|
||||||
'soft_delete_field' => '',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// PDO连接参数
|
// PDO连接参数
|
||||||
|
|||||||
@@ -39,9 +39,7 @@ class Think
|
|||||||
if (empty($this->config['view_path'])) {
|
if (empty($this->config['view_path'])) {
|
||||||
$this->config['view_path'] = App::$modulePath . 'view' . DS;
|
$this->config['view_path'] = App::$modulePath . 'view' . DS;
|
||||||
}
|
}
|
||||||
if (App::$debug) {
|
|
||||||
$this->config['tpl_cache'] = false;
|
|
||||||
}
|
|
||||||
$this->template = new Template($this->config);
|
$this->template = new Template($this->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user