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

Echo ·
更新时间:2024-09-20
· 723 次阅读

写入过程
代码如下:
// 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');
您可能感兴趣的文章:joomla实现注册用户添加新字段的方法Joomla数据库操作之JFactory::getDBO用法Joomla使用Apache重写模式的方法Joomla开启SEF的方法Joomla简单判断用户是否登录的方法Joomla实现组件中弹出一个模式(modal)窗口的方法joomla组件开发入门教程joomla数据库操作示例代码CKeditor与syntaxhighlight打造joomla代码高亮joomla内置的表单验证功能使用方法了解Joomla 这款来自国外的php网站管理系统Joomla语言翻译类Jtext用法分析



joomla 数据 PHP

需要 登录 后方可回复, 如果你还没有账号请 注册新账号