Joomla下利用configuration.php存储简单数据
翟鸿燊讲座,中国好声音谁是总冠军,小黑游戏美女
写入过程
// get the path of the configuration file
$fname = jpath_configuration.ds.'configuration.php';
// clear cache
$cache = jfactory::getcache();
$cache->clean();
// update the credentials with the new settings
$config =& jfactory::getconfig();
$config->setvalue('config.custom_var', 'xxx');
// get the config registry in php class format and write it to configuation.php
jimport('joomla.filesystem.file');
if (!jfile::write($fname, $config->tostring('php', 'config', array('class' => 'jconfig')))) {
die(jtext::_('errorconfigfile'));
}
提取过程
global $mainframe;
$mainframe->getcfg('custom_var');
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
网友评论