mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
规范文件
This commit is contained in:
45
base.php
45
base.php
@@ -9,37 +9,36 @@
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
if(version_compare(PHP_VERSION,'5.4.0','<')) die('require PHP > 5.4.0 !');
|
||||
define('MAGIC_QUOTES_GPC', false);
|
||||
|
||||
// 版本信息
|
||||
define('THINK_VERSION', '4.0beta');
|
||||
// 系统常量
|
||||
defined('THINK_PATH') or define('THINK_PATH', dirname(__FILE__).'/');
|
||||
defined('LIB_PATH') or define('LIB_PATH', THINK_PATH.'library/');
|
||||
defined('MODE_PATH') or define('MODE_PATH', THINK_PATH.'mode/'); // 系统应用模式目录
|
||||
defined('TRAIT_PATH') or define('TRAIT_PATH', THINK_PATH.'traits/');
|
||||
defined('CORE_PATH') or define('CORE_PATH', LIB_PATH.'think/');
|
||||
defined('ORG_PATH') or define('ORG_PATH', LIB_PATH.'org/');
|
||||
defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');
|
||||
defined('RUNTIME_PATH') or define('RUNTIME_PATH', realpath(APP_PATH).'/runtime/');
|
||||
defined('DATA_PATH') or define('DATA_PATH', RUNTIME_PATH.'data/');
|
||||
defined('LOG_PATH') or define('LOG_PATH', RUNTIME_PATH.'log/');
|
||||
defined('CACHE_PATH') or define('CACHE_PATH', RUNTIME_PATH.'cache/');
|
||||
defined('TEMP_PATH') or define('TEMP_PATH', RUNTIME_PATH.'temp/');
|
||||
defined('VENDOR_PATH') or define('VENDOR_PATH', THINK_PATH.'vendor/');
|
||||
defined('EXT') or define('EXT', '.php');
|
||||
defined('MODEL_LAYER') or define('MODEL_LAYER', 'model');
|
||||
defined('VIEW_LAYER') or define('VIEW_LAYER', 'view');
|
||||
defined('CONTROLLER_LAYER') or define('CONTROLLER_LAYER', 'controller');
|
||||
defined('APP_DEBUG') or define('APP_DEBUG', false); // 是否调试模式
|
||||
defined('THINK_PATH') || define('THINK_PATH', dirname(__FILE__).'/');
|
||||
defined('LIB_PATH') || define('LIB_PATH', THINK_PATH.'library/');
|
||||
defined('MODE_PATH') || define('MODE_PATH', THINK_PATH.'mode/'); // 系统应用模式目录
|
||||
defined('TRAIT_PATH') || define('TRAIT_PATH', THINK_PATH.'traits/');
|
||||
defined('CORE_PATH') || define('CORE_PATH', LIB_PATH.'think/');
|
||||
defined('ORG_PATH') || define('ORG_PATH', LIB_PATH.'org/');
|
||||
defined('APP_PATH') || define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');
|
||||
defined('RUNTIME_PATH') || define('RUNTIME_PATH', realpath(APP_PATH).'/runtime/');
|
||||
defined('DATA_PATH') || define('DATA_PATH', RUNTIME_PATH.'data/');
|
||||
defined('LOG_PATH') || define('LOG_PATH', RUNTIME_PATH.'log/');
|
||||
defined('CACHE_PATH') || define('CACHE_PATH', RUNTIME_PATH.'cache/');
|
||||
defined('TEMP_PATH') || define('TEMP_PATH', RUNTIME_PATH.'temp/');
|
||||
defined('VENDOR_PATH') || define('VENDOR_PATH', THINK_PATH.'vendor/');
|
||||
defined('EXT') || define('EXT', '.php');
|
||||
defined('MODEL_LAYER') || define('MODEL_LAYER', 'model');
|
||||
defined('VIEW_LAYER') || define('VIEW_LAYER', 'view');
|
||||
defined('CONTROLLER_LAYER') || define('CONTROLLER_LAYER', 'controller');
|
||||
defined('APP_DEBUG') || define('APP_DEBUG', false); // 是否调试模式
|
||||
|
||||
if(function_exists('saeAutoLoader')){// 自动识别SAE环境
|
||||
defined('APP_MODE') or define('APP_MODE', 'sae');
|
||||
defined('STORAGE_TYPE') or define('STORAGE_TYPE', 'Sae');
|
||||
defined('APP_MODE') || define('APP_MODE', 'sae');
|
||||
defined('STORAGE_TYPE') || define('STORAGE_TYPE', 'Sae');
|
||||
}else{
|
||||
defined('APP_MODE') or define('APP_MODE', 'common'); // 应用模式 默认为普通模式
|
||||
defined('STORAGE_TYPE') or define('STORAGE_TYPE', 'File'); // 存储类型 默认为File
|
||||
defined('APP_MODE') || define('APP_MODE', 'common'); // 应用模式 默认为普通模式
|
||||
defined('STORAGE_TYPE') || define('STORAGE_TYPE', 'File'); // 存储类型 默认为File
|
||||
}
|
||||
|
||||
// 环境常量
|
||||
|
||||
4
library/think/cache/driver/secache.php
vendored
4
library/think/cache/driver/secache.php
vendored
@@ -161,7 +161,7 @@ class SecacheClient{
|
||||
if(!file_exists($this->_file)){
|
||||
$this->create();
|
||||
}else{
|
||||
$this->_rs = fopen($this->_file,'rb+') or $this->trigger_error('Can\'t open the cachefile: '.realpath($this->_file),E_USER_ERROR);
|
||||
$this->_rs = fopen($this->_file,'rb+') || $this->trigger_error('Can\'t open the cachefile: '.realpath($this->_file),E_USER_ERROR);
|
||||
$this->_seek($this->header_padding);
|
||||
$info = unpack('V1max_size/a*ver',fread($this->_rs,$this->info_size));
|
||||
if($info['ver']!=$this->ver){
|
||||
@@ -178,7 +178,7 @@ class SecacheClient{
|
||||
}
|
||||
|
||||
function create(){
|
||||
$this->_rs = fopen($this->_file,'wb+') or $this->trigger_error('Can\'t open the cachefile: '.realpath($this->_file),E_USER_ERROR);;
|
||||
$this->_rs = fopen($this->_file,'wb+') || $this->trigger_error('Can\'t open the cachefile: '.realpath($this->_file),E_USER_ERROR);;
|
||||
fseek($this->_rs,0);
|
||||
fputs($this->_rs,'<'.'?php exit()?'.'>');
|
||||
return $this->_format();
|
||||
|
||||
@@ -25,9 +25,11 @@ class Loader {
|
||||
include self::$map[$class];
|
||||
}else{ // 命名空间自动加载
|
||||
$name = strstr($class, '\\', true);
|
||||
if(isset(self::$namespace[$name])){ // 注册的命名空间
|
||||
if(isset(self::$namespace[$name])){
|
||||
// 注册的命名空间
|
||||
$path = dirname(self::$namespace[$name]) . '/';
|
||||
}elseif(is_dir(LIB_PATH.$name)){ // Library目录下面的命名空间自动定位
|
||||
}elseif(in_array($name,['think','org','behavior','com']) || is_dir(LIB_PATH.$name)){
|
||||
// Library目录下面的命名空间自动定位
|
||||
$path = LIB_PATH;
|
||||
}else{ // 项目命名空间
|
||||
$path = APP_PATH;
|
||||
@@ -78,7 +80,7 @@ class Loader {
|
||||
//加载当前项目应用类库
|
||||
$class = substr_replace($class, '', 0, strlen($class_strut[0]) + 1);
|
||||
$baseUrl = MODULE_PATH;
|
||||
}elseif (in_array($class_strut[0], ['think','org', 'com'])) {
|
||||
}elseif (in_array($class_strut[0], ['think','behavior','org', 'com'])) {
|
||||
// org 第三方公共类库 com 企业公共类库
|
||||
$baseUrl = LIB_PATH;
|
||||
}elseif(in_array($class_strut[0], ['vendor', 'traits'])){
|
||||
|
||||
@@ -138,7 +138,7 @@ class Session {
|
||||
* @return void
|
||||
*/
|
||||
static public function delete($name,$prefix='') {
|
||||
$prefix = $prefix?$prefix:$this->prefix;
|
||||
$prefix = $prefix ? $prefix : self::$prefix;
|
||||
if(strpos($name,'.')){
|
||||
list($name1,$name2) = explode('.',$name);
|
||||
if($prefix){
|
||||
@@ -161,7 +161,7 @@ class Session {
|
||||
* @return void
|
||||
*/
|
||||
static public function clear($prefix='') {
|
||||
$prefix = $prefix?$prefix:self::$prefix;
|
||||
$prefix = $prefix ? $prefix : self::$prefix;
|
||||
if($prefix) {
|
||||
unset($_SESSION[$prefix]);
|
||||
}else{
|
||||
|
||||
@@ -168,7 +168,7 @@ class View {
|
||||
list($module,$template) = explode('@',$template);
|
||||
}
|
||||
// 获取当前主题的模版路径
|
||||
defined('THEME_PATH') or define('THEME_PATH', $this->getThemePath($module));
|
||||
defined('THEME_PATH') || define('THEME_PATH', $this->getThemePath($module));
|
||||
|
||||
// 分析模板文件规则
|
||||
if('' == $template) {
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: luofei614 <weibo.com/luofei614>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* SAE模式惯例配置文件
|
||||
* 该文件请不要修改,如果要覆盖惯例配置的值,可在应用配置文件中设定和惯例不符的配置项
|
||||
* 配置名称大小写任意,系统会统一转换成小写
|
||||
* 所有配置参数都可以在生效前动态改变
|
||||
*/
|
||||
defined('THINK_PATH') or exit();
|
||||
$st = new SaeStorage();
|
||||
return array(
|
||||
//SAE下固定mysql配置
|
||||
'DB_TYPE' => 'mysql', // 数据库类型
|
||||
'DB_DEPLOY_TYPE' => 1,
|
||||
'DB_RW_SEPARATE' => true,
|
||||
'DB_HOST' => SAE_MYSQL_HOST_M.','.SAE_MYSQL_HOST_S, // 服务器地址
|
||||
'DB_NAME' => SAE_MYSQL_DB, // 数据库名
|
||||
'DB_USER' => SAE_MYSQL_USER, // 用户名
|
||||
'DB_PWD' => SAE_MYSQL_PASS, // 密码
|
||||
'DB_PORT' => SAE_MYSQL_PORT, // 端口
|
||||
//更改模板替换变量,让普通能在所有平台下显示
|
||||
'TMPL_PARSE_STRING' => array(
|
||||
// __PUBLIC__/upload --> /Public/upload -->http://appname-public.stor.sinaapp.com/upload
|
||||
'/Public/upload' => $st->getUrl('public','upload')
|
||||
),
|
||||
'LOG_TYPE' => 'Sae',
|
||||
'DATA_CACHE_TYPE' => 'Memcachesae',
|
||||
'CHECK_APP_DIR' => false,
|
||||
'FILE_UPLOAD_TYPE' => 'Sae',
|
||||
);
|
||||
Reference in New Issue
Block a user