Storage::has(MODULE_PATH . 'Data/install.lock')这个类的作用一眼就可以看出是检查Data/install.lock是否存在的。但是这个Storage类库代码的分析有点看不懂,请教各位由于Storage没有has方法,所以调用了Storage类的__callstatic方法
static public function __callstatic($method,$args){
$type=end($args);
$method_type=$method.ucfirst($type);
if(method_exists(self::$handler, $method_type)){
return call_user_func_array(array(self::$handler,$method_type), $args);
}
//调用缓存类型自己的方法
if(method_exists(self::$handler, $method)){
return call_user_func_array(array(self::$handler,$method), $args);
}
}即这个方法中$type='./Application/Install/Data/install.lock';
$method_type='has./Application/Install/Data/install.lock';问题1:他是怎么调用自动调用
static public function connect($type,$options=array())方法的,并且$type=File问题2:
class File extends Storage{为什么要继承Storage类 ,File类里面 什么地方需要用到Storage类我删掉extends Storage简单测试,也没什么问题和报错
最佳答案