當前位置: 首頁>>代碼示例>>PHP>>正文


PHP min_enable_zlib_compression函數代碼示例

本文整理匯總了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;
}
開發者ID:ncsu-delta,項目名稱:moodle,代碼行數:31,代碼來源:jslib.php

示例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;
}
開發者ID:esyacelga,項目名稱:sisadmaca,代碼行數:19,代碼來源:yui_combo.php

示例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');
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:30,代碼來源:jquery.php

示例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;
}
開發者ID:numbas,項目名稱:moodle,代碼行數:17,代碼來源:javascript.php

示例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;
}
開發者ID:nadavkav,項目名稱:moodle-accessibility,代碼行數:23,代碼來源:lib.php

示例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;
}
開發者ID:masaterutakeno,項目名稱:MoodleMobile,代碼行數:27,代碼來源:csslib.php

示例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;
}
開發者ID:sebastiansanio,項目名稱:tallerdeprogramacion2fiuba,代碼行數:15,代碼來源:styles.php


注:本文中的min_enable_zlib_compression函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。