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