Php Zend框架:关于bootstrape和应用程序类
区别是什么:Php Zend框架:关于bootstrape和应用程序类,php,zend-framework,Php,Zend Framework,区别是什么: $application = new Zend_Application(...); $application->bootstrap()->run(); $application = new Zend_Application(...); $application->run(); 为什么我们需要call->bootstrape然后call->run?为什么不直接从Zend Sources类:Zend_应用程序,文件:application.php调用applica
$application = new Zend_Application(...);
$application->bootstrap()->run();
$application = new Zend_Application(...);
$application->run();
为什么我们需要call->bootstrape然后call->run?为什么不直接从Zend Sources类:Zend_应用程序,文件:application.php调用application->run?
public function bootstrap($resource = null)
{
$this->getBootstrap()->bootstrap($resource);
return $this;
}
public function run()
{
$this->getBootstrap()->run();
}
第一个样本
$application = new Zend_Application(...);
$application->bootstrap()->run();
调用Zend_应用程序_Bootstrap_Bootstrap::Bootstrap方法,最终加载所有资源。然后它调用
Zend\u Application\u Bootstrap\u Bootstrap::run()
,实际发送请求
第二个样本
$application = new Zend_Application(...);
$application->run();
根据上面的代码,它将跳过第一步,因此它将尝试在不实际加载资源的情况下运行(分派请求)。
这就是Zend引导和资源的方式