简介:这是zend_application 说明的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。
class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=329786' scrolling='no'>1.变量 $_environment 指定加载ini或xml 配置文件 的那一段
用法如下:
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap()->run();
$application->bootstrap()->run();
写道
public function __construct($environment, $options = null)
{
$this->_environment = (string) $environment;
//。。。。
}
}
{
$this->_environment = (string) $environment;
//。。。。
}
}
写道
protected function _loadConfig($file)
{
$environment = $this->getEnvironment();
$suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
switch ($suffix) {
case 'ini':
$config = new Zend_Config_Ini($file, $environment);
break;
case 'xml':
$config = new Zend_Config_Xml($file, $environment);
break;
case 'php':
case 'inc':
$config = include $file;
if (!is_array($config)) {
throw new Zend_Application_Exception('Invalid configuration file provided; PHP file does not return array value');
}
return $config;
break;
default:
throw new Zend_Application_Exception('Invalid configuration file provided; unknown config type');
}
return $config->toArray();
}
{
$environment = $this->getEnvironment();
$suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
switch ($suffix) {
case 'ini':
$config = new Zend_Config_Ini($file, $environment);
break;
case 'xml':
$config = new Zend_Config_Xml($file, $environment);
break;
case 'php':
case 'inc':
$config = include $file;
if (!is_array($config)) {
throw new Zend_Application_Exception('Invalid configuration file provided; PHP file does not return array value');
}
return $config;
break;
default:
throw new Zend_Application_Exception('Invalid configuration file provided; unknown config type');
}
return $config->toArray();
}