mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
规范调整
This commit is contained in:
8
base.php
8
base.php
@@ -230,7 +230,7 @@ function U($url, $vars = '', $suffix = true, $domain = false)
|
||||
function session($name, $value = '')
|
||||
{
|
||||
if (is_array($name)) {
|
||||
// 初始化
|
||||
// 初始化
|
||||
think\Session::init($name);
|
||||
} elseif (is_null($name)) {
|
||||
// 清除
|
||||
@@ -250,7 +250,7 @@ function session($name, $value = '')
|
||||
function cookie($name, $value = '')
|
||||
{
|
||||
if (is_array($name)) {
|
||||
// 初始化
|
||||
// 初始化
|
||||
think\Cookie::init($name);
|
||||
} elseif (is_null($name)) {
|
||||
// 清除
|
||||
@@ -278,14 +278,14 @@ function S($name, $value = '', $options = null)
|
||||
{
|
||||
static $cache = null;
|
||||
if (is_array($options)) {
|
||||
// 缓存操作的同时初始化
|
||||
// 缓存操作的同时初始化
|
||||
$cache = think\Cache::connect($options);
|
||||
} elseif (is_array($name)) {
|
||||
// 缓存初始化
|
||||
$cache = think\Cache::connect($name);
|
||||
return $cache;
|
||||
} elseif (is_null($cache)) {
|
||||
// 自动初始化
|
||||
// 自动初始化
|
||||
$cache = think\Cache::connect();
|
||||
}
|
||||
if ('' === $value) {
|
||||
|
||||
@@ -13,8 +13,10 @@ namespace think;
|
||||
|
||||
class Config
|
||||
{
|
||||
private static $config = []; // 配置参数
|
||||
private static $range = '_sys_'; // 参数作用域
|
||||
// 配置参数
|
||||
private static $config = [];
|
||||
// 参数作用域
|
||||
private static $range = '_sys_';
|
||||
|
||||
// 设定配置参数的作用域
|
||||
public static function range($range)
|
||||
|
||||
@@ -15,12 +15,18 @@ class Cookie
|
||||
{
|
||||
|
||||
protected static $config = [
|
||||
'prefix' => '', // cookie 名称前缀
|
||||
'expire' => 0, // cookie 保存时间
|
||||
'path' => '/', // cookie 保存路径
|
||||
'domain' => '', // cookie 有效域名
|
||||
'secure' => false, // cookie 启用安全传输
|
||||
'httponly' => '', // httponly设置
|
||||
// cookie 名称前缀
|
||||
'prefix' => '',
|
||||
// cookie 保存时间
|
||||
'expire' => 0,
|
||||
// cookie 保存路径
|
||||
'path' => '/',
|
||||
// cookie 有效域名
|
||||
'domain' => '',
|
||||
// cookie 启用安全传输
|
||||
'secure' => false,
|
||||
// httponly设置
|
||||
'httponly' => '',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,9 +16,10 @@ namespace think;
|
||||
*/
|
||||
class Db
|
||||
{
|
||||
|
||||
private static $instance = []; // 数据库连接实例
|
||||
private static $_instance = null; // 当前数据库连接实例
|
||||
// 数据库连接实例
|
||||
private static $instance = [];
|
||||
// 当前数据库连接实例
|
||||
private static $_instance = null;
|
||||
|
||||
/**
|
||||
* 取得数据库类实例
|
||||
|
||||
@@ -11,6 +11,5 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
class Exception extends \Exception {
|
||||
|
||||
}
|
||||
class Exception extends \Exception
|
||||
{}
|
||||
|
||||
@@ -13,8 +13,10 @@ namespace think;
|
||||
|
||||
class Lang
|
||||
{
|
||||
private static $lang = []; // 语言参数
|
||||
private static $range = '_sys_'; // 作用域
|
||||
// 语言参数
|
||||
private static $lang = [];
|
||||
// 作用域
|
||||
private static $range = '_sys_';
|
||||
|
||||
// 设定语言参数的作用域
|
||||
public static function range($range)
|
||||
|
||||
@@ -18,7 +18,7 @@ class Model
|
||||
const MODEL_UPDATE = 2; // 更新
|
||||
const MODEL_BOTH = 3; // 全部
|
||||
// 当前数据库操作对象
|
||||
protected $db = null;
|
||||
protected $db = null;
|
||||
// 数据库对象池
|
||||
private $_db = [];
|
||||
// 主键名称
|
||||
|
||||
@@ -18,8 +18,10 @@ namespace think;
|
||||
*/
|
||||
class Template
|
||||
{
|
||||
protected $data = []; // 模板变量
|
||||
protected $config = [ // 引擎配置
|
||||
// 模板变量
|
||||
protected $data = [];
|
||||
// 引擎配置
|
||||
protected $config = [
|
||||
'tpl_path' => VIEW_PATH, // 模板路径
|
||||
'tpl_suffix' => '.html', // 默认模板文件后缀
|
||||
'cache_suffix' => '.php', // 默认模板缓存后缀
|
||||
|
||||
@@ -13,10 +13,14 @@ namespace think;
|
||||
|
||||
class View
|
||||
{
|
||||
protected $engine = null; // 模板引擎实例
|
||||
protected $theme = ''; // 模板主题名称
|
||||
protected $data = []; // 模板变量
|
||||
protected $config = [ // 视图参数
|
||||
// 模板引擎实例
|
||||
protected $engine = null;
|
||||
// 模板主题名称
|
||||
protected $theme = '';
|
||||
// 模板变量
|
||||
protected $data = [];
|
||||
// 视图参数
|
||||
protected $config = [
|
||||
'theme_on' => false,
|
||||
'auto_detect_theme' => false,
|
||||
'var_theme' => 't',
|
||||
|
||||
@@ -20,9 +20,9 @@ require CORE_PATH . 'loader.php';
|
||||
Loader::register();
|
||||
|
||||
// 注册错误和异常处理机制
|
||||
register_shutdown_function(['think\error', 'appShutdown']);
|
||||
set_error_handler(['think\error', 'appError']);
|
||||
set_exception_handler(['think\error', 'appException']);
|
||||
register_shutdown_function(['think\Error', 'appShutdown']);
|
||||
set_error_handler(['think\Error', 'appError']);
|
||||
set_exception_handler(['think\Error', 'appException']);
|
||||
|
||||
// 加载模式定义文件
|
||||
$mode = require MODE_PATH . APP_MODE . EXT;
|
||||
|
||||
Reference in New Issue
Block a user