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');
相关推荐
godfather 2020-06-03
Liuzqi 2015-04-13
89447517 2011-07-28
走向WEB开发 2010-12-03
austindev 2017-01-14
ithover 2015-04-13
JAVA飘香 2019-06-26
wangdoudou0 2013-07-09
海欣海夜 2013-06-04
AnyBisks 2013-02-21
RENYUAN 2011-04-17
kukelook 2018-12-28
新开源王 2017-06-28
83133756 2016-10-18
logobitch 2011-12-31
ROES 2017-12-07
xujinweigingko 2018-03-21
Scalzdp 2018-12-28