本文整理汇总了PHP中putFileContents函数的典型用法代码示例。如果您正苦于以下问题:PHP putFileContents函数的具体用法?PHP putFileContents怎么用?PHP putFileContents使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了putFileContents函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
}
// Restore loading functions
if ($core == "true") {
$content .= "tinyMCE_GZ.end();";
}
// Generate GZIP'd content
if ($supportsGzip && is_writable(dirname($cacheFile))) {
if ($compress) {
header("Content-Encoding: " . $enc);
$cacheData = gzencode($content, 9, FORCE_GZIP);
} else {
$cacheData = $content;
}
// Write gz file
if ($diskCache && $cacheKey != "") {
putFileContents($cacheFile, $cacheData);
}
// Stream to client
echo $cacheData;
} else {
// Stream uncompressed content
echo $content;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function getParam($name, $def = false)
{
if (!isset($_GET[$name])) {
return $def;
}
return preg_replace("/[^0-9a-z\\-_,]+/i", "", $_GET[$name]);
// Remove anything but 0-9,a-z,-_
示例2: putFileContents
//
$filename = null;
$isWritable = null;
if (isset($_POST['stylesheet']) && in_array($_POST['stylesheet'], $stylesheets)) {
$filename = $pathToStyles . $_POST['stylesheet'];
if (is_writable($filename)) {
$isWritable = true;
} else {
$isWritable = false;
}
}
//
// Check if Save-button was pressed, save the file if true.
//
if (isset($_POST['doSave'])) {
$resFromSave = putFileContents($filename, strip_tags($_POST['styleContent']));
}
//
// Create a select/option-list based on the content of the array $stylesheets
//
// http://php.net/manual/en/control-structures.foreach.php
// Look up select/option in Cheatsheet
//
$select = "<select id='input1' name='stylesheet' onchange='form.submit();'>";
$select .= "<option value='-1'>Välj Stylesheet</option>";
foreach ($stylesheets as $val) {
$selected = "";
if (isset($_POST['stylesheet']) && $_POST['stylesheet'] == $val) {
$selected = "selected";
}
$select .= "<option value='{$val}' {$selected}>{$val}</option>";
示例3: gzencode
if ( '.gz' == $cache_ext ) {
header('Content-Encoding: gzip');
$content = gzencode( $content, 9, FORCE_GZIP );
}
// Stream to client
echo $content;
// Write file
if ( '' != $cacheKey && is_dir($cache_path) && is_readable($cache_path) ) {
$old_cache = array();
$handle = opendir($cache_path);
while ( false !== ( $file = readdir($handle) ) ) {
if ( $file == '.' || $file == '..' ) continue;
$saved = filectime("$cache_path/$file");
if ( strpos($file, 'tinymce_') !== false && substr($file, -3) == $cache_ext ) $old_cache["$saved"] = $file;
}
closedir($handle);
krsort($old_cache);
if ( 1 >= $old_cache_max ) $del_cache = $old_cache;
else $del_cache = array_slice( $old_cache, ($old_cache_max - 1) );
foreach ( $del_cache as $key )
@unlink("$cache_path/$key");
putFileContents( $cache_file, $content );
}
?>
示例4: putFileContents
//
$filename = null;
$isWritable = null;
if (isset($_POST['file']) && in_array($_POST['file'], $files)) {
$filename = $path . $_POST['file'];
if (is_writable($filename)) {
$isWritable = true;
} else {
$isWritable = false;
}
}
//
// Check if Save-button was pressed, save the file if true.
//
if (isset($_POST['doSave'])) {
$res = putFileContents($filename, strip_tags($_POST['content'], "<b><i><p><img>"));
}
//
// Create a select/option-list based on the content of the array $files
//
$select = "<select id='input1' name='file' onchange='form.submit();'>";
$select .= "<option value='-1'>Välj Annons</option>";
foreach ($files as $val) {
$selected = "";
if (isset($_POST['file']) && $_POST['file'] == $val) {
$selected = "selected";
}
$select .= "<option value='{$val}' {$selected}>{$val}</option>";
}
$select .= "</select>";
?>