本文整理汇总了PHP中JFile::Write方法的典型用法代码示例。如果您正苦于以下问题:PHP JFile::Write方法的具体用法?PHP JFile::Write怎么用?PHP JFile::Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFile
的用法示例。
在下文中一共展示了JFile::Write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doExecute
/**
* Entry point for the script
*
* @return void
*
* @since 1.0
*/
public function doExecute()
{
jimport('joomla.filesystem.file');
if (file_exists(JPATH_BASE . '/configuration.php') || file_exists(JPATH_BASE . '/config.php')) {
$configfile = file_exists(JPATH_BASE . 'configuration.php') ? JPATH_BASE . '/config.php' : JPATH_BASE . '/configuration.php';
if (is_writable($configfile)) {
$config = file_get_contents($configfile);
//Do a simple replace for the CMS and old school applications
$newconfig = str_replace('public $offline = \'0\'', 'public $offline = \'1\'', $config);
// Newer applications generally use JSON instead.
if (!$newconfig) {
$newconfig = str_replace('"public $offline":"0"', '"public $offline":"1"', $config);
}
if (!$newconfig) {
$this->out('This application does not have an offline configuration setting.');
} else {
JFile::Write($configfile, &$newconfig);
$this->out('Site is offline');
}
} else {
$this->out('The file is not writable, you need to change the file permissions first.');
$this->out();
}
} else {
$this->out('This application does not have a configuration file');
}
$this->out();
}
示例2: shSaveFile
function shSaveFile($shFileName, $fileData)
{
if (empty($shFileName)) {
return;
}
$fileIsThere = file_exists($shFileName);
if (!$fileIsThere || $fileIsThere && is_writable($shFileName)) {
if (is_array($fileData)) {
$fileData = implode("\n", $fileData);
//make sure we write a string
}
JFile::Write($shFileName, empty($fileData) ? '' : $fileData);
}
}