Home Backend Development PHP Tutorial Joomla下利用configuration.php存储简单数据_php技巧

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

May 17, 2016 am 09:25 AM
joomla Storing data

写入过程
复制代码 代码如下:

// 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');
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1517
276
Steps and precautions for using localstorage to store data Steps and precautions for using localstorage to store data Jan 11, 2024 pm 04:51 PM

Steps and precautions for using localStorage to store data This article mainly introduces how to use localStorage to store data and provides relevant code examples. LocalStorage is a way of storing data in the browser that keeps the data local to the user's computer without going through a server. The following are the steps and things to pay attention to when using localStorage to store data. Step 1: Check whether the browser supports LocalStorage

Steps to use localstorage to store data Steps to use localstorage to store data Jan 11, 2024 am 09:14 AM

How to use localstorage to store data? Introduction: localstorage is a browser local storage mechanism provided by HTML5, through which data can be easily stored and read in the browser. This article will introduce how to use localstorage to store data and provide specific code examples. This article is divided into the following parts: 1. Introduction to localstorage; 2. Steps to use localstorage to store data; 3. Code examples; 4. Frequently asked questions

Detailed steps to deploy a Joomla website on PhpStudy Detailed steps to deploy a Joomla website on PhpStudy May 16, 2025 pm 08:00 PM

The steps to deploy a Joomla website on PhpStudy include: 1) Configure PhpStudy, ensure that Apache and MySQL services run and check PHP version compatibility; 2) Download and decompress PhpStudy's website from the official Joomla website, and then complete the installation through the browser according to the installation wizard; 3) Make basic configurations, such as setting the website name and adding content.

Golang learning Web application development based on Joomla Golang learning Web application development based on Joomla Jun 24, 2023 pm 12:15 PM

Golang is a programming language with high concurrency and high reliability, which has attracted much attention in web development in recent years. Joomla is an open source content management system with good modularity and ease of use. This article uses Golang as the main development language and Joomla as the basic framework to introduce a Joomla-based Web application development method. 1. Introduction to Joomla Joomla is an open source CMS system developed based on PHP. It has many advantages, such as ease of use, flexibility

How does blockchain store data? How does blockchain store data? Sep 05, 2023 pm 05:01 PM

The ways in which blockchain stores data include file storage, database storage, cache storage, distributed storage, storage network and smart contract storage. Detailed introduction: 1. File storage. Blockchain can store data in the form of files. This method is relatively simple. You can use any text editor to create a blockchain file and store the data in it. This method has data security. and reliability issues, because files may be tampered with or deleted; 2. Database storage, blockchain can store data in the form of a database, which can improve data security and reliability, etc.

What is distributed storage data protection? What is distributed storage data protection? Jan 04, 2024 pm 03:33 PM

Protection methods include: 1. Redundant backup; 2. Fault tolerance; 3. Erasure coding technology; 4. Remote replication; 5. Fully symmetrical and fully redundant software and hardware design; 6. Automatic data reconstruction and recovery mechanism; 7. File/directory level snapshot; 8. Power failure protection mechanism. Detailed introduction: 1. Redundant backup: Distributed storage will store multiple copies of data on multiple nodes, ensuring that even if one node or storage device fails, data can still be recovered from other copies; 2. Fault tolerance: Distribution Storage systems are typically fault-tolerant and can detect and correct data corruption or loss, among other things.

Pagoda Panel: One-click installation of WordPress, Joomla and other CMS Pagoda Panel: One-click installation of WordPress, Joomla and other CMS Jun 21, 2023 pm 04:18 PM

Pagoda Panel is a web-based server management software that can help users quickly deploy websites, applications and databases on Linux servers. Among them, a key function of the Pagoda Panel is the one-click installation of various open source CMS, including WordPress, Joomla, Drupal, etc. For a website administrator who is not familiar with server management, manually deploying a CMS can be a tedious task. Including the process of downloading the software, decompressing, configuring the database, and uploading the files to the server. These steps are

How to use JSON format in MySQL to store and query data? How to use JSON format in MySQL to store and query data? Jul 30, 2023 pm 09:37 PM

How to use JSON format in MySQL to store and query data? In modern application development, using JSON format to store and query data has become a common practice. JSON (JavaScriptObjectNotation) is a lightweight data exchange format that is widely used for front-end and back-end data transmission, configuration files, logging, etc. MySQL has introduced support for JSON fields starting from version 5.7, allowing us to store them directly in MySQL

See all articles