规范文件

This commit is contained in:
thinkphp
2015-02-21 17:32:41 +08:00
parent 9346bda0f0
commit 1a4a102b49
11 changed files with 32 additions and 70 deletions

View File

@@ -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();

View File

@@ -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'])){

View File

@@ -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{

View File

@@ -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) {