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.ini配置文件 php.ini中影响上传的有以下几处: file_uploads 是否开启 on 必须开启 是否允许HT...

PHP base64+gzinflate压缩编码和解码代码

base64+gzinflate压缩编码(加密)过的文件通常是以 <? eval(gzinflate(base64_decode( 为头的一个php文件。以下我们给出了相关的编码解...

PHP用GD库生成高质量的缩略图片

以下是PHP源代码(ResizeImage.php)。 复制代码 代码如下: <?php $FILENAME="image.thumb"; // 生成图片的宽度 $RESIZEWI...

php网页后退不再出现过期

<?php  ob_start();  if(function_exists(session_cache_limiter)) { sessi...

WebQQ最新登陆协议的用法

本文实例讲述了WebQQ最新登陆协议的用法。分享给大家供大家参考。具体分析如下: WebQQ协议更新后,原登陆算法等信息改变,导致很多朋友无法正常登陆,本站发布了一些与WebQQ最新登陆...