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


PHP sendNoCache函数代码示例

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


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

示例1: error

function error($type, $allowReload = false)
{
    global $CONFIG, $themeReplace, $options, $phrases, $flag;
    # Get extra arguments
    $args = func_get_args();
    # Remove first argument (we have that as $type)
    array_shift($args);
    # Check error exists
    # Force to the "unknown" error message
    if (!isset($phrases[$type])) {
        $args = array($type);
        $type = 'unknown_error';
    }
    if ($args) {
        # Error text must be generated by calling sprintf - we only have
        # the extra args as an array so we have to use call_user_func_array
        $errorText = call_user_func_array('sprintf', array_merge((array) $phrases[$type], $args));
    } else {
        # Error text can be fetched simply from the $phrases array
        $errorText = $phrases[$type];
    }
    # If in frame or ajax, don't redirect back to index
    if (isset($flag) && ($flag == 'frame' || $flag == 'ajax')) {
        die($errorText . ' <a href="index.php">Return to index</a>.');
    }
    # Finally add it to the $themeReplace array to get it in there
    $themeReplace['error'] = '<div id="error">' . $errorText . '</div>';
    # And a link to try again?
    $return = currentURL();
    if (strlen($return) > 0) {
        $themeReplace['error'] .= '<p style="text-align:right">[<a href="' . htmlentities($return) . '">Reload ' . htmlentities(deproxyURL($return)) . '</a>]</p>';
    }
    # Start with an empty array
    $toShow = array();
    # Loop through the available options
    foreach ($CONFIG['options'] as $name => $details) {
        # Check we're allowed to choose
        if (!empty($details['force'])) {
            continue;
        }
        # Generate the HTML 'checked' where appropriate
        $checked = $options[$name] ? ' checked="checked"' : '';
        # Add to the toShow array
        $toShow[] = array('name' => $name, 'title' => $details['title'], 'desc' => $details['desc'], 'escaped_desc' => str_replace("'", "\\'", $details['desc']), 'checked' => $checked);
    }
    sendNoCache();
    $vars2['toShow'] = $toShow;
    echo loadTemplate('main', $vars2);
    # And flush buffer
    ob_end_flush();
    exit;
}
开发者ID:milan-hwj,项目名称:tempGit,代码行数:52,代码来源:init.php

示例2: header

 case 'not_modified':
     header("HTTP/1.1 304 Not Modified", true, 304);
     exit;
     # 401 Authentication (HTTP authentication hooks not available in all PHP versions
     # so we have to use our method)
 # 401 Authentication (HTTP authentication hooks not available in all PHP versions
 # so we have to use our method)
 case 'auth_required':
     # Ensure we have some means of authenticating and extract details about the type of authentication
     if (!isset($fetch->headers['www-authenticate'])) {
         break;
     }
     # Realm to display to the user
     $realm = preg_match('#\\brealm="([^"]*)"#i', $fetch->headers['www-authenticate'], $tmp) ? $tmp[1] : '';
     # Prevent caching
     sendNoCache();
     # Prepare template variables (session may be closed at this point so send via form)
     $tmp = array('site' => $URL['scheme_host'], 'realm' => $realm, 'return' => currentURL());
     # Show our form and quit
     echo loadTemplate('authenticate.page', $tmp);
     exit;
     # File request above filesize limit
 # File request above filesize limit
 case 'filesize_limit':
     # If already sent some of the file, we can't display an error
     # so just stop running
     if (!$fetch->parseType) {
         exit;
     }
     # Send to error page with filesize limit expressed in MB
     error('file_too_large', round($CONFIG['max_filesize'] / 1024 / 1024, 3));
开发者ID:yyhaoyue,项目名称:PHPProxy,代码行数:31,代码来源:browse.php

示例3: error

function error($type, $allowReload = false)
{
    global $phrases, $flag;
    // Get extra arguments
    $args = func_get_args();
    // Remove first argument (we have that as $type)
    array_shift($args);
    // Check error exists
    if (!isset($phrases[$type])) {
        // Force to the "unknown" error message
        $args = array($type);
        $type = 'unknown_error';
    }
    // If in frame or ajax, don't redirect back to index
    if (isset($flag) && ($flag == 'frame' || $flag == 'ajax')) {
        // Extra arguments to take care of?
        if ($args) {
            // Error text must be generated by calling sprintf - we only have
            // the extra args as an array so we have to use call_user_func_array
            $errorText = call_user_func_array('sprintf', array_merge((array) $phrases[$type], $args));
        } else {
            // Error text can be fetched simply from the $phrases array
            $errorText = $phrases[$type];
        }
        die($errorText . ' <a href="index.php">Return to index</a>.');
    }
    // Still here? Not frame so serialize to pass in query string
    $pass = $args ? '&p=' . base64_encode(serialize($args)) : '';
    // Don't cache the error
    sendNoCache();
    // Do we want to allow refresh?
    $return = $allowReload ? '&return=' . rawurlencode(currentURL()) : '';
    // And go to error page
    redirect('index.php?e=' . $type . $return . $pass);
    exit;
}
开发者ID:alberthier,项目名称:fullmetalgalaxy,代码行数:36,代码来源:init.php


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