当前位置: 首页>>代码示例>>PHP>>正文


PHP header_nocache函数代码示例

本文整理汇总了PHP中header_nocache函数的典型用法代码示例。如果您正苦于以下问题:PHP header_nocache函数的具体用法?PHP header_nocache怎么用?PHP header_nocache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了header_nocache函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: headers_content_mightcache

/**
 * This is a placeholder for future development.
 *
 * @param string content-type; override for RSS feeds
 * @param integer seconds
 * @param string charset
 * @param boolean flush already collected content from the PageCache
 */
function headers_content_mightcache($type = 'text/html', $max_age = '#', $charset = '#', $flush_pagecache = true)
{
    global $Messages, $is_admin_page;
    global $PageCache, $Debuglog;
    header_content_type($type, $charset);
    if (empty($max_age) || $is_admin_page || is_logged_in() || $Messages->count()) {
        // Don't cache if no max_age given
        // + NEVER EVER allow admin pages to cache
        // + NEVER EVER allow logged in data to be cached
        // + NEVER EVER allow transactional Messages to be cached!:
        header_nocache();
        // Check server caching too, but note that this is a different caching process then caching on the client
        // It's important that this is a double security check only and server caching should be prevented before this
        // If something should not be cached on the client, it should never be cached on the server either
        if (!empty($PageCache)) {
            // Abort PageCache collect
            $Debuglog->add('Abort server caching in headers_content_mightcache() function. This should have been prevented!');
            $PageCache->abort_collect($flush_pagecache);
        }
        return;
    }
    // If we are on a "normal" page, we may, under some circumstances, tell the browser it can cache the data.
    // This MAY be extremely confusing though, every time a user logs in and gets back to a screen with no evobar!
    // This cannot be enabled by default and requires admin switches.
    // For feeds, it is a little bit less confusing. We might want to have the param enabled by default in that case.
    // WARNING: extra special care needs to be taken before ever caching a blog page that might contain a form or a comment preview
    // having user details cached would be extremely bad.
    // in the meantime...
    header_nocache();
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:38,代码来源:_template.funcs.php

示例2: s_page_header

    /**
     * 输出客服操作页面页头 s_page_header
     */
    protected function s_page_header($path = '')
    {
        header_nocache();
        //不缓存
        echo '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>' . APP::$_CFG['Title'] . '</title>
<link rel="shortcut icon" href="' . SYSDIR . 'public/img/favicon.ico" type="image/x-icon"> 
<link rel="stylesheet" type="text/css" href="' . SYSDIR . 'public/admin.css">
<link rel="stylesheet" type="text/css" href="' . SYSDIR . 'public/easyDialog/easyDialog.css">
<link rel="stylesheet" type="text/css" href="' . SYSDIR . 'public/jquery.tipTip.css">
<script src="' . SYSDIR . 'public/jquery191.js" type="text/javascript"></script>
<script src="' . SYSDIR . 'public/jquery.tipTip.js" type="text/javascript"></script>
<script src="' . SYSDIR . 'public/jquery.scrollbar.js" type="text/javascript"></script>
<script src="' . SYSDIR . 'public/support.js" type="text/javascript"></script>
<script type="text/javascript">
var this_uri = "' . strstr($_SERVER['REQUEST_URI'], 'index.php') . '",
BASEURL = "' . BASEURL . '",
SYSDIR = "' . SYSDIR . '",
WS_HOST = "' . WS_HOST . '",
WS_PORT = "' . WS_PORT . '",
update_time = ' . ForceInt(APP::$_CFG['Update']) . ',
admin ={id: ' . $this->admin['aid'] . ', type: ' . $this->admin['type'] . ', sid: "' . $this->admin['sid'] . '", fullname: "' . $this->admin['fullname'] . '", post: "' . $this->admin['post'] . '", agent: "' . $this->admin['agent'] . '"};
</script>
</head>
<body class="online">
<script src="' . SYSDIR . 'public/easyDialog/easyDialog.js" type="text/javascript"></script>
' . $this->s_header_menu($path, 1) . '
<div class="maindiv">
<div id="main">';
    }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:37,代码来源:class.Admin.php

示例3: define

GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Remi Collet
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
if (!isset($_POST["id"])) {
    exit;
}
if (!isset($_REQUEST['glpi_tab'])) {
    exit;
}
ajaxFooter();
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:30,代码来源:device.tabs.php

示例4: nullHeader

/**
 * Print a nice HTML head with no controls
 *
 * @param $title title of the page
 * @param $url not used anymore.
 **/
function nullHeader($title, $url = '')
{
    global $CFG_GLPI, $HEADER_LOADED, $LANG;
    if ($HEADER_LOADED) {
        return;
    }
    $HEADER_LOADED = true;
    // Print a nice HTML-head with no controls
    // Detect root_doc in case of error
    Config::detectRootDoc();
    // Send UTF8 Headers
    header("Content-Type: text/html; charset=UTF-8");
    // Send extra expires header if configured
    header_nocache();
    if (isCommandLine()) {
        return true;
    }
    includeCommonHtmlHeader($title);
    // Body with configured stuff
    echo "<body>";
    echo "<div id='page'>";
    echo "<div id='bloc'>";
    echo "<div class='haut'></div>";
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:30,代码来源:display.function.php

示例5: retrieve


//.........这里部分代码省略.........
         $retrieved_url = trim($lines[0]);
         unset($lines[0]);
         if ($retrieved_url != $ReqURL) {
             $Debuglog->add('Cached file URL [' . $retrieved_url . '] does not match current URL, aborting retrieve.', 'pagecache');
             return false;
         }
         // timestamp of cache generation:
         $retrieved_ts = trim($lines[1]);
         unset($lines[1]);
         $cache_age = $servertimenow - $retrieved_ts;
         $Debuglog->add('Cache age: ' . floor($cache_age / 60) . ' min ' . $cache_age % 60 . ' sec', 'pagecache');
         if ($cache_age > $this->max_age_seconds || $last_invalidation_timestamp > $retrieved_ts) {
             // Cache has expired
             return false;
         }
         $i = 1;
         $optional_headers = array();
         // Go through optional header lines
         // Optional headers are separated from the file header with an empty line.
         while ($optional_header_line = trim($lines[++$i])) {
             // All optional header name value must be separated with ':'
             if (strpos($optional_header_line, ':') === false) {
                 $Debuglog->add('Cached file format not recognized, aborting retrieve.', 'pagecache');
                 return false;
             }
             list($header_name, $header_value) = explode(":", $optional_header_line);
             // Optional header name and value must not be empty
             $header_name = trim($header_name);
             $header_value = trim($header_value);
             if (empty($header_name) || empty($header_value)) {
                 $Debuglog->add('Cached file format not recognized, aborting retrieve.', 'pagecache');
                 return false;
             }
             $optional_headers[$header_name] = $header_value;
             unset($lines[$i]);
         }
         // unset the empty line
         unset($lines[$i]);
         // count item views happening on this page:
         if (isset($optional_headers['item_IDs_on_this_page'])) {
             global $shutdown_count_item_views;
             $shutdown_count_item_views = explode(',', $optional_headers['item_IDs_on_this_page']);
         }
         // Check if the request has an If-Modified-Since date
         if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
             $if_modified_since = strtotime(preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']));
             if ($retrieved_ts <= $if_modified_since) {
                 // Cached version is equal to (or older than) $if_modified since; contents probably not modified...
                 // It is still possible that in between we have sent logged-in versions (including evobar) of the page
                 // and that the browser has an evobar version of the page in cache. Let's verify this before sending a 304...
                 // We do this with an ETag header (another solution may be the Vary header)
                 if (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) {
                     $if_none_match = $_SERVER['HTTP_IF_NONE_MATCH'];
                     // pre_dump($if_none_match, gen_current_page_etag() );
                     if ($if_none_match == gen_current_page_etag()) {
                         // Ok, this seems to be really the same:
                         header_http_response('304 Not Modified');
                         exit(0);
                     }
                 }
             }
         }
         // Page was modified, revert $shutdown_count_item_views set
         $shutdown_count_item_views = array();
         // ============== Ready to send cached version of the page =================
         // Send no cache header including last modified date:
         header_nocache($retrieved_ts);
         // Go through headers that were saved in the cache:
         // $i was already set
         while ($headerline = trim($lines[++$i])) {
             header($headerline);
             unset($lines[$i]);
         }
         unset($lines[$i]);
         // SEND CONTENT!
         $body = implode('', $lines);
         $Timer->pause('Cache file processing');
         $Timer->resume('Sending cached content');
         // Echo a first chunk (see explanation below)
         $buffer_size = 12000;
         // Empiric value, you can make it smaller if you show me screenshots of better timings with a smaller value
         echo substr($body, 0, $buffer_size);
         ob_start();
         // fp> So why do we want an ob_start here?
         // fp> Because otherwise echo will "hang" until all the data gets passed through apache (on default Apache install with default SendBufferSize)
         // fp> With ob_start() the script will terminate much faster and the total exec time of the script will look much smaller.
         // fp> This doesn't actually improve the speed of the transmission, it just lets the PHP script exit earlier
         // fp> DRAWBACK: shutdown will be executed *before* the "ob" data is actually sent :'(
         // fp> This is why we send a first chunk of data before ob_start(). shutdown can occur while that data is sent. then the remainder is sent.
         // Inspiration: http://wonko.com/post/seeing_poor_performance_using_phps_echo_statement_heres_why
         //              http://fplanque.com/dev/linux/how-to-log-request-processing-times-in-apache
         //              http://fplanque.com/dev/linux/why-echo-is-slow-in-php-how-to-make-it-really-fast
         // fp> TODO: do something similar during page cache collection.
         echo substr($body, $buffer_size);
         // ob_end_flush(); // fp> WARNING: Putting an end flush here would just kill the benefit of the ob_start() above.
         $Timer->pause('Sending cached content');
         return true;
     }
     return false;
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_pagecache.class.php

示例6: __construct

 public function __construct($path)
 {
     parent::__construct($path);
     header_nocache();
     //不缓存
 }
开发者ID:noikiy,项目名称:meilala,代码行数:6,代码来源:opensocket.php


注:本文中的header_nocache函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。