首页 > 编程 > PHP > 正文

thinkphp核心源码注释|Storage.class.php

2019-11-11 02:36:25
字体:
来源:转载
供稿:网友
<?php// +----------------------------------------------------------------------// | TOPThink [ WE CAN DO IT JUST THINK ]// +----------------------------------------------------------------------// | Copyright (c) 2013 http://topthink.com All rights reserved.// +----------------------------------------------------------------------// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )// +----------------------------------------------------------------------// | Author: liu21st <liu21st@Gmail.com>// +----------------------------------------------------------------------namespace Think;// 分布式文件存储类// 存贮居然还是分布式存储,这个分布式,就是class Storage { /** * 操作句柄 * @var string * @access PRotected */ static protected $handler ;// 保存了 什么东东呢? 一般 handler 是 操作句柄 /** * 连接分布式文件系统 * @access public * @param string $type 文件类型 * @param array $options 配置数组 * @return void */ static public function connect($type='File',$options=array()) {// 连接 位置 $class = 'Think//Storage//Driver//'.ucWords($type); self::$handler = new $class($options); } // 这里的连接,就是变成了一个存储class api 的一个调用 static public function __callstatic($method,$args){// 申请的函数 //调用缓存驱动的方法 if(method_exists(self::$handler, $method)){ return call_user_func_array(array(self::$handler,$method), $args); } }}// 总结: 连接,并且自动转接 实际的函数。// 最没有,或者最有战略价值的一个
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表