//一步步去分析 Zend_Application最重要的一项 /** * Set bootstrap path/class * Application中实例化引导类 * @author wolf [Email: 116311316@qq.com] * @param string $path * @param string $class * @return Zend_Application */ public function setBootstrap($path, $class = null) { // setOptions() can potentially send a null value; specify default // here if (null === $class) { $class = 'Bootstrap'; } /** * class_exists 中的false参数是 是否自动调用autoload */ if (! class_exists ( $class, false )) { require_once $path; if (! class_exists ( $class, false )) { echo $class . "类不存在,请检查路径和类名"; } } /* * 这里实例化bootstrap类的时候 在Zend_Application_Bootstrap_BootstrapAbstract中 * 的setApplication检查是否继承Zend_Application */ $this->_bootstrap = new $class ( $this ); Custom_Benchmark::print_r ( $this ); /** * 这里再次检查类的完整性 */ if (! $this->_bootstrap instanceof Zend_Application_Bootstrap_Bootstrapper) { throw new Zend_Application_Exception ( 'Bootstrap class does not implement Zend_Application_Bootstrap_Bootstrapper' ); } return $this; }