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

2015-01-24信息快讯网

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'); 
基于Zend的Config机制的应用分析
PHP中防止直接访问或查看或下载config.php文件的方法
php中配置文件操作 如config.php文件的读取修改等操作
让Json更懂中文(JSON_UNESCAPED_UNICODE)
提示Trying to clone an uncloneable object of class Imagic的解决
Session保存到数据库的php类分享
jQuery EasyUI API 中文文档 - DateBox日期框
Admin generator, filters and I18n
如何在symfony中导出为CSV文件中的数据
linux iconv方法的使用
PHP将DateTime对象转化为友好时间显示的实现代码
PHP pathinfo()获得文件的路径、名称等信息说明
PHP-CGI进程CPU 100% 与 file_get_contents 函数的关系分析
php中使用Curl、socket、file_get_contents三种方法POST提交数据
兼容firefox,chrome的网页灰度效果
让Nginx支持ThinkPHP的URL重写和PATHINFO的方法分享
PHP Undefined index报错的修复方法
Windows7下PHP开发环境安装配置图文方法
php UTF-8、Unicode和BOM问题
php 提速工具eAccelerator 配置参数详解
php date()日期时间函数详解
php imagecreatetruecolor 创建高清和透明图片代码小结
php file_exists 检查文件或目录是否存在的函数
php is_file 判断给定文件名是否为一个正常的文件
PHP 面向对象 final类与final方法
在Windows下编译适用于PHP 5.2.12及5.2.13的eAccelerator.dll(附下载)
mayfish 数据入库验证代码
asp.net Repeater控件的说明及详细介绍及使用方法
php file_get_contents函数轻松采集html数据
PHP iconv 解决utf-8和gb2312编码转换问题
Fatal error: Call to undefined function curl_init()解决方法
有关JSON以及JSON在PHP中的应用
php session和cookie使用说明
phpinfo 系统查看参数函数代码
PHP setcookie() cannot modify header information 的解决方法
Cannot modify header information错误解决方法
PHP base64+gzinflate压缩编码和解码代码
©2014-2024 dbsqp.com