有几行代码不是太懂,请高手帮忙分析
这个代码摘自ThinkPHP框架里的某个小片段
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> /** +---------------------- * 取得对象实例 支持调用类的静态方法 +---------------------- * @param string $class 对象类名 * @param string $method 类的静态方法名 +---------------------- * @return object +---------------------- */ static public function instance($class,$method='') { $identify = $class.$method; if(!isset(self::$_instance[$identify])) { //这一行的self::不是太明白怎么回事 if(class_exists($class)){ //这个是判断如果类存在? $o = new $class(); if(!empty($method) && method_exists($o,$method)) self::$_instance[$identify] = call_user_func_array(array(&$o, $method)); //这一行怎么解释? else self::$_instance[$identify] = $o; //这一行怎么解释? } else halt(L('_CLASS_NOT_EXIST_').':'.$class); //halt从来没见过这东西…… } return self::$_instance[$identify]; }
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号