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

yipeiwu_com6年前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');

相关文章

php简单实现无限分类树形列表的方法

本文实例讲述了php简单实现无限分类树形列表的方法。分享给大家供大家参考。具体如下: $items = array( 1 => array('id' => 1, '...

PHP基于php_imagick_st-Q8.dll实现JPG合成GIF图片的方法

一、概述: 本文详解了PHP基于php_imagick_st-Q8.dll实现JPG合成GIF图片的方法。 首先要实现PHP使用php_imagick_st-Q8.dll类库,把JPG图...

php && 逻辑与运算符使用说明

例子:!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc()); o(︶︿︶)...

php常用数学函数汇总

本文实例汇总并分析了php常用数学函数。分享给大家供大家参考。具体分析如下: abs()函数定义和用法: 返回一个数的绝对值. 语法:abs(x),代码如下: 复制代码 代码如下:$ab...

使用PHP实现密保卡功能实现代码<打包下载直接运行>

使用PHP实现密保卡功能实现代码<打包下载直接运行>

效果图:密保卡入库 复制代码 代码如下: $this->load->model('admin/m_mibao'); $data = array(); //生成随机横坐标 $r...