本文整理汇总了PHP中files::write方法的典型用法代码示例。如果您正苦于以下问题:PHP files::write方法的具体用法?PHP files::write怎么用?PHP files::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类files
的用法示例。
在下文中一共展示了files::write方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: siteMap
function siteMap()
{
db::table('pages');
db::where('site_id', ADMIN_SITE_ID);
db::where('page_map', '1');
db::where('page_dynamic', '0');
$res = db::select();
$content = '';
while ($row = mysql_fetch_assoc($res)) {
$content .= '
<url>
<loc>http://' . ADMIN_SITE . $row['page_folder'] . '</loc>
<lastmod>' . substr($row['page_date'], 0, 10) . '</lastmod>
</url>';
}
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . $content . '
</urlset>';
if (files::write(ROOT . '/sitemap.xml', $xml)) {
buffer::set('sitemap.xml успешно создан.');
} else {
buffer::set('Не удалось записать sitemap.xml.');
}
}
示例2: save
function save()
{
$array = file(ROOT . '/config.php');
$content = '';
foreach ($array as $k => $v) {
if (strstr($v, '#system_style')) {
$array[$k] = "define('SYS_STYLE', '" . params::get('system_style') . "'); #system_style\r\n";
}
if (strstr($v, '#system_lang')) {
$array[$k] = "define('LANG_INDEX', '" . params::get('system_lang') . "'); #system_lang\r\n";
}
if (strstr($v, '#global_cache')) {
if (params::get('global_cache')) {
$array[$k] = "define('GLOBAL_CACHE', true); #global_cache\r\n";
} else {
$array[$k] = "define('GLOBAL_CACHE', false); #global_cache\r\n";
}
}
if (strstr($v, '#global_time')) {
$array[$k] = "define('GLOBAL_CACHE_TIME', " . params::get('global_cache_time') . "); #global_time\r\n";
}
$content .= $array[$k];
}
files::write(ROOT . '/config.php', $content);
headers::self();
}
示例3: save
function save()
{
$content = ob_get_contents();
ob_clean();
files::write(self::$file, $content);
echo $content;
}
示例4: write
function write($array = false, $file = false, $sections = true)
{
if (!$file) {
$file = self::$file;
}
if (!$array) {
$array = self::$ini;
}
$string = '';
if ($sections) {
foreach (array_keys($array) as $key) {
$string .= '[' . $key . "]\r\n";
$string .= self::_write($array[$key], '') . "\r\n";
}
} else {
foreach ($array as $k => $v) {
$string .= self::__write($k, $v) . "\r\n";
}
}
files::write($file, $string);
}
示例5: restoreVersion
function restoreVersion($app, $tmpl_file, $version_id)
{
db::table('templates_versions');
db::where('version_id', $version_id);
$row = db::assoc();
$rows = db::rows();
$code = stripslashes($row['version_code']);
$file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $app . '/' . $tmpl_file;
header("Content-Type: text/plain; charset=UTF-8");
files::write($file, $code);
if ($rows != 0) {
self::deleteVersion($version_id);
}
router::delQs('restore');
headers::selfQs();
}
示例6: _save
function _save()
{
$tmpl_file = params::get('tmpl_file');
$tmpl_id = params::get('tmpl_id');
if (empty($tmpl_file)) {
$tmpl_file = 'tmpl' + $tmpl_id + '.html';
}
db::table('templates');
db::where('tmpl_id', $tmpl_id);
db::update(array('tmpl_pub' => '1', 'tmpl_name' => params::get('tmpl_name'), 'tmpl_file' => $tmpl_file));
/*
Code write
*/
$code = stripslashes(params::get('tmpl_code'));
$file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $tmpl_file;
header("Content-Type: text/plain; charset=UTF-8");
files::write($file, $code);
$allPages = params::get('allPages');
$pages = params::get('pages');
if ($allPages !== false) {
db::table('pages');
db::where('site_id', ADMIN_SITE_ID);
db::update('tmpl_id', $tmpl_id);
} else {
if ($pages) {
foreach ($pages as $v) {
db::table('pages');
db::where('page_id', $v);
db::update('tmpl_id', $tmpl_id);
}
}
}
if (events::detect('save')) {
self::saveVersion($tmpl_id, $code);
}
}