Joomla下利用configuration.php存储简单数据
程序员文章站
2022-06-08 22:06:33
写入过程 复制代码 代码如下: // get the path of the configuration file $fname = jpath_configuration...
写入过程
// 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');
复制代码 代码如下:
// 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下利用configuration.php存储简单数据
-
Joomla下利用configuration.php存储简单数据
-
mysql下,怎么利用数据表来实现多个序列的存储及递增
-
Joomla下利用configuration.php存储简单数据_PHP教程
-
configuration Joomla下利用configurationphp存储简单数据
-
mysql下,怎么利用数据表来实现多个序列的存储及递增
-
Joomla下利用configuration.php存储简单数据_php技巧
-
configuration Joomla下利用configurationphp存储简单数据
-
Joomla下利用configuration.php存储简单数据_php技巧