プロジェクト/index.php
<?php
error_reporting(E_ALL|E_STRICT);
date_default_timezone_set('Europe/London');
set_include_path('.' . PATH_SEPARATOR . './library'
. PATH_SEPARATOR . './application/models/'
. PATH_SEPARATOR . get_include_path());
include "Zend/Loader.php";
Zend_Loader::loadClass('Zend_Controller_Front');
// setup controller
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->setControllerDirectory('./application/controllers');
// run!
$frontController->dispatch();
?>
Zend/コントローラー/Front.php
<?php
...
class Zend_Controller_Front
{
...
protected static $_instance = null;
...
protected $_throwExceptions = false;
...
protected function __construct()
{
$this->_plugins = new Zend_Controller_Plugin_Broker();
}
...
public static function getInstance()
{
if (null === self::$_instance) {
self::$_instance = new self();
}
return self::$_instance;
}
...
public function throwExceptions($flag = null)
{
if ($flag !== null) {
$this->_throwExceptions = (bool) $flag;
return $this;
}
return $this->_throwExceptions;
}
...
}
...
?>
質問:
$this->_plugins = new Zend_Controller_Plugin_Broker();
このクラスの使用法は何ですか:Zend_Controller_Plugin_Broker
? project/index.php では何もしていないようですpublic function throwExceptions($flag = null)
なぜ$flag !== null, return $this;
その間に$flag == null, return $this->_throwExceptions;
?両方とも $this を返さないのはなぜですか?$frontController->setControllerDirectory('./application/controllers');
「。」現在のディレクトリを意味しますか?なぜ「.」が必要なのですか?