写入过程
复制代码 代码如下:
// 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');
以上就介绍了configuration joomla下利用configurationphp存储简单数据,包括了configuration方面的内容,希望对php教程有兴趣的朋友有所帮助。