本文整理汇总了PHP中Zend_Config_Writer_Ini::setRenderWithoutSections方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Writer_Ini::setRenderWithoutSections方法的具体用法?PHP Zend_Config_Writer_Ini::setRenderWithoutSections怎么用?PHP Zend_Config_Writer_Ini::setRenderWithoutSections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Config_Writer_Ini
的用法示例。
在下文中一共展示了Zend_Config_Writer_Ini::setRenderWithoutSections方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* @param string $type
*/
public function create()
{
/* @var $userConfig Zend_Tool_Framework_Client_Config */
$userConfig = $this->_registry->getConfig();
$resp = $this->_registry->getResponse();
if ($userConfig->exists()) {
require_once "Zend/Tool/Framework/Exception.php";
throw new Zend_Tool_Framework_Exception(
"A configuration already exists, cannot create a new one.");
}
$homeDirectory = $this->_detectHomeDirectory();
$writer = new Zend_Config_Writer_Ini();
$writer->setRenderWithoutSections();
$filename = $homeDirectory."/.zf.ini";
$config = array(
'php' => array(
'include_path' => get_include_path(),
),
);
$writer->write($filename, new Zend_Config($config));
$resp = $this->_registry->getResponse();
$resp->appendContent("Successfully written Zend Tool config.");
$resp->appendContent("It is located at: ".$filename);
}
示例2: getConfigWriter
/**
* Get the config writer that corresponds to the current config file type.
*
* @return Zend_Config_Writer_FileAbstract
*/
protected function getConfigWriter()
{
$suffix = substr($this->getConfigFilepath(), -4);
switch ($suffix) {
case '.ini':
// require_once "Zend/Config/Writer/Ini.php";
$writer = new Zend_Config_Writer_Ini();
$writer->setRenderWithoutSections();
break;
case '.xml':
// require_once "Zend/Config/Writer/Xml.php";
$writer = new Zend_Config_Writer_Xml();
break;
case '.php':
// require_once "Zend/Config/Writer/Array.php";
$writer = new Zend_Config_Writer_Array();
break;
default:
// require_once 'Zend/Tool/Framework/Client/Exception.php';
throw new Zend_Tool_Framework_Client_Exception('Unknown config file type ' . $suffix . ' at location ' . $this->getConfigFilepath());
}
return $writer;
}
示例3: testRenderWithoutSections2
public function testRenderWithoutSections2()
{
$config = new Zend_Config_Ini(dirname(__FILE__) . '/files/allsections.ini', null, array('skipExtends' => true));
$writer = new Zend_Config_Writer_Ini();
$writer->setRenderWithoutSections();
$iniString = $writer->setConfig($config)->render();
$expected = <<<ECS
all.hostname = "all"
all.name = "thisname"
all.db.host = "127.0.0.1"
all.db.user = "username"
all.db.pass = "password"
all.db.name = "live"
all.one.two.three = "multi"
staging.hostname = "staging"
staging.db.name = "dbstaging"
staging.debug = ""
debug.hostname = "debug"
debug.debug = "1"
debug.values.changed = "1"
debug.db.name = "dbdebug"
debug.special.no = ""
debug.special.null = ""
debug.special.false = ""
other_staging.only_in = "otherStaging"
other_staging.db.pass = "anotherpwd"
ECS;
$this->assertEquals($expected, $iniString);
}
示例4: addSettingsFile
/**
* For now only contains the database source environment, but can be used to add more
* configuration that's needed at restore time.
*
* @return void
*/
public function addSettingsFile()
{
$config = new Zend_Config(array(), true);
$config->gumball = array();
$config->gumball->sourceDbEnvironment = $this->_dbEnv;
$writer = new Zend_Config_Writer_Ini(array('config' => $config, 'filename' => $this->_getTargetDirectoryPath() . '/application/configs/gumball.ini'));
$writer->setRenderWithoutSections();
$writer->write();
}