zend_application 说明

简介:这是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();
写道
public function __construct($environment, $options = null)
{
$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();
}

“zend_application 说明”的更多相关文章 》

爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

http://biancheng.dnbcw.info/php/329786.html pageNo:11

posted on 2011-11-15 10:20  圣者  阅读(106)  评论(0编辑  收藏  举报

导航