当前位置: 移动技术网 > IT编程>开发语言>PHP > Joomla下利用configuration.php存储简单数据

Joomla下利用configuration.php存储简单数据

2019年04月29日  | 移动技术网IT编程  | 我要评论

翟鸿燊讲座,中国好声音谁是总冠军,小黑游戏美女

写入过程
复制代码 代码如下:

// 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');

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网