|
本文实例讲述了Zend Framework中Zend_Config组件用法。分享给大家供大家参考,具体如下:
1.从PHP数组中读取数据
使用Zend_Config_Ini(读取ini配置文件)
Zend_Config_Xml(读取XML配置文件)
案例:
'127.0.0.1',
'database'=>array(
'db_host'=>'localhost',
'db_user'=>'root',
'db_pass'=>'123',
'db_name'=>'test'
)
);
$config = new Zend_Config($array);
echo "Web服务器地址为:";
echo $config->webhost;
echo "";
echo "数据库服务器名称为:";
echo $config->database->db_host;
echo "";
echo "数据库用户名为:";
echo $config->database->db_user;
echo "";
echo "数据库密码为:";
echo $config->database->db_pass;
echo "";
echo "数据库名称为:";
echo $config->database->db_name;
echo "";
|
|