本文整理汇总了PHP中min_enable_zlib_compression函数的典型用法代码示例。如果您正苦于以下问题:PHP min_enable_zlib_compression函数的具体用法?PHP min_enable_zlib_compression怎么用?PHP min_enable_zlib_compression使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了min_enable_zlib_compression函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: js_send_cached
/**
* Send javascript file content with as much caching as possible
* @param string $jspath
* @param string $etag
* @param string $filename
*/
function js_send_cached($jspath, $etag, $filename = 'javascript.php') {
require(__DIR__ . '/xsendfilelib.php');
$lifetime = 60*60*24*60; // 60 days only - the revision may get incremented quite often
header('Etag: "'.$etag.'"');
header('Content-Disposition: inline; filename="'.$filename.'"');
header('Last-Modified: '. gmdate('D, d M Y H:i:s', filemtime($jspath)) .' GMT');
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
header('Pragma: ');
header('Cache-Control: public, max-age='.$lifetime);
header('Accept-Ranges: none');
header('Content-Type: application/javascript; charset=utf-8');
if (xsendfile($jspath)) {
die;
}
if (!min_enable_zlib_compression()) {
header('Content-Length: '.filesize($jspath));
}
readfile($jspath);
die;
}
示例2: combo_send_uncached
/**
* Send the JavaScript uncached
* @param string $content
* @param string $mimetype
*/
function combo_send_uncached($content, $mimetype)
{
header('Content-Disposition: inline; filename="combo"');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 2) . ' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
header('Content-Type: ' . $mimetype);
if (!min_enable_zlib_compression()) {
header('Content-Length: ' . strlen($content));
}
echo $content;
die;
}
示例3: header
header('Etag: '.$etag);
header('Content-Disposition: inline; filename="'.$filename.'"');
header('Last-Modified: '. gmdate('D, d M Y H:i:s', filemtime($file)) .' GMT');
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
header('Pragma: ');
header('Cache-Control: public, max-age='.$lifetime);
header('Accept-Ranges: none');
header('Content-Type: '.$mimetype);
if (xsendfile($file)) {
die;
}
if ($mimetype === 'text/css' or $mimetype === 'application/javascript') {
if (!min_enable_zlib_compression()) {
header('Content-Length: '.filesize($file));
}
} else {
// No need to compress images.
header('Content-Length: '.filesize($file));
}
readfile($file);
die;
function jquery_file_not_found() {
// Note: we can not disclose the exact file path here, sorry.
header('HTTP/1.0 404 not found');
示例4: send_cached_js
function send_cached_js($jspath) {
$lifetime = 60*60*24*30; // 30 days
header('Content-Disposition: inline; filename="javascript.php"');
header('Last-Modified: '. gmdate('D, d M Y H:i:s', filemtime($jspath)) .' GMT');
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
header('Pragma: ');
header('Cache-Control: max-age='.$lifetime);
header('Accept-Ranges: none');
header('Content-Type: application/javascript; charset=utf-8');
if (!min_enable_zlib_compression()) {
header('Content-Length: '.filesize($jspath));
}
readfile($jspath);
die;
}
示例5: theme_essential_send_cached_css
function theme_essential_send_cached_css($path, $filename, $lastmodified, $etag)
{
global $CFG;
require_once $CFG->dirroot . '/lib/configonlylib.php';
// For min_enable_zlib_compression().
// 60 days only - the revision may get incremented quite often.
$lifetime = 60 * 60 * 24 * 60;
header('Etag: "' . $etag . '"');
header('Content-Disposition: inline; filename="' . $filename . '"');
if ($lastmodified) {
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $lastmodified) . ' GMT');
}
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT');
header('Pragma: ');
header('Cache-Control: public, max-age=' . $lifetime);
header('Accept-Ranges: none');
header('Content-Type: text/css; charset=utf-8');
if (!min_enable_zlib_compression()) {
header('Content-Length: ' . filesize($path . $filename));
}
readfile($path . $filename);
die;
}
示例6: css_send_cached_css
/**
* Sends a cached CSS file
*
* This function sends the cached CSS file. Remember it is generated on the first
* request, then optimised/minified, and finally cached for serving.
*
* @param string $csspath The path to the CSS file we want to serve.
* @param string $etag The revision to make sure we utilise any caches.
*/
function css_send_cached_css($csspath, $etag)
{
$lifetime = 60 * 60 * 24 * 60;
// 60 days only - the revision may get incremented quite often
header('Etag: "' . $etag . '"');
header('Content-Disposition: inline; filename="styles.php"');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($csspath)) . ' GMT');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT');
header('Pragma: ');
header('Cache-Control: public, max-age=' . $lifetime);
header('Accept-Ranges: none');
header('Content-Type: text/css; charset=utf-8');
if (!min_enable_zlib_compression()) {
header('Content-Length: ' . filesize($csspath));
}
readfile($csspath);
die;
}
示例7: send_cached_css
function send_cached_css($csspath, $rev)
{
$lifetime = 60 * 60 * 24 * 20;
header('Content-Disposition: inline; filename="styles.php"');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($csspath)) . ' GMT');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
header('Content-Type: text/css; charset=utf-8');
if (!min_enable_zlib_compression()) {
header('Content-Length: ' . filesize($csspath));
}
readfile($csspath);
die;
}