本文整理汇总了PHP中smarty_core_read_cache_file函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_core_read_cache_file函数的具体用法?PHP smarty_core_read_cache_file怎么用?PHP smarty_core_read_cache_file使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_core_read_cache_file函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/**
* executes & returns or displays the template results
*
* @param string $resource_name
* @param string $cache_id
* @param string $compile_id
* @param boolean $display
*/
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
{
static $_cache_info = array();
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting) ? $this->error_reporting : error_reporting() & ~E_NOTICE);
if (!$this->debugging && $this->debugging_ctrl == 'URL') {
$_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
if (@strstr($_query_string, $this->_smarty_debug_id)) {
if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
// enable debugging for this browser session
@setcookie('SMARTY_DEBUG', true);
$this->debugging = true;
} elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) {
// disable debugging for this browser session
@setcookie('SMARTY_DEBUG', false);
$this->debugging = false;
} else {
// enable debugging for this page
$this->debugging = true;
}
} else {
$this->debugging = (bool) ($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
}
}
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$_debug_start_time = smarty_core_get_microtime($_params, $this);
$this->_smarty_debug_info[] = array('type' => 'template', 'filename' => $resource_name, 'depth' => 0);
$_included_tpls_idx = count($this->_smarty_debug_info) - 1;
}
if (!isset($compile_id)) {
$compile_id = $this->compile_id;
}
$this->_compile_id = $compile_id;
$this->_inclusion_depth = 0;
if ($this->caching) {
// save old cache_info, initialize cache_info
array_push($_cache_info, $this->_cache_info);
$this->_cache_info = array();
$_params = array('tpl_file' => $resource_name, 'cache_id' => $cache_id, 'compile_id' => $compile_id, 'results' => null);
require_once SMARTY_CORE_DIR . 'core.read_cache_file.php';
if (smarty_core_read_cache_file($_params, $this)) {
$_smarty_results = $_params['results'];
if (!empty($this->_cache_info['insert_tags'])) {
$_params = array('plugins' => $this->_cache_info['insert_tags']);
require_once SMARTY_CORE_DIR . 'core.load_plugins.php';
smarty_core_load_plugins($_params, $this);
$_params = array('results' => $_smarty_results);
require_once SMARTY_CORE_DIR . 'core.process_cached_inserts.php';
$_smarty_results = smarty_core_process_cached_inserts($_params, $this);
}
if (!empty($this->_cache_info['cache_serials'])) {
$_params = array('results' => $_smarty_results);
require_once SMARTY_CORE_DIR . 'core.process_compiled_include.php';
$_smarty_results = smarty_core_process_compiled_include($_params, $this);
}
if ($display) {
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
require_once SMARTY_CORE_DIR . 'core.display_debug_console.php';
$_smarty_results .= smarty_core_display_debug_console($_params, $this);
}
if ($this->cache_modified_check) {
$_server_vars = $this->request_use_auto_globals ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
$_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
$_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']) . ' GMT';
if (@count($this->_cache_info['insert_tags']) == 0 && !$this->_cache_serials && $_gmt_mtime == $_last_modified_date) {
if (php_sapi_name() == 'cgi') {
header('Status: 304 Not Modified');
} else {
header('HTTP/1.1 304 Not Modified');
}
} else {
header('Last-Modified: ' . $_gmt_mtime);
echo $_smarty_results;
}
} else {
echo $_smarty_results;
}
error_reporting($_smarty_old_error_level);
// restore initial cache_info
$this->_cache_info = array_pop($_cache_info);
return true;
} else {
error_reporting($_smarty_old_error_level);
// restore initial cache_info
$this->_cache_info = array_pop($_cache_info);
return $_smarty_results;
//.........这里部分代码省略.........
示例2: fetch
/**
* executes & returns or displays the template results
*
* @param string $resource_name
* @param string $cache_id
* @param string $compile_id
* @param boolean $display
*/
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
{
static $_cache_info = array();
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting) ? $this->error_reporting : error_reporting() & ~E_NOTICE);
if (!$this->debugging && $this->debugging_ctrl == 'URL') {
$_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
if (@strstr($_query_string, $this->_smarty_debug_id)) {
if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
// enable debugging for this browser session
@setcookie('SMARTY_DEBUG', true);
$this->debugging = true;
} elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) {
// disable debugging for this browser session
@setcookie('SMARTY_DEBUG', false);
$this->debugging = false;
} else {
// enable debugging for this page
$this->debugging = true;
}
} else {
$this->debugging = (bool) ($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
}
}
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$_debug_start_time = smarty_core_get_microtime($_params, $this);
$this->_smarty_debug_info[] = array('type' => 'template', 'filename' => $resource_name, 'depth' => 0);
$_included_tpls_idx = count($this->_smarty_debug_info) - 1;
}
if (!isset($compile_id)) {
$compile_id = $this->compile_id;
}
$this->_compile_id = $compile_id;
$this->_inclusion_depth = 0;
if ($this->caching) {
// save old cache_info, initialize cache_info
array_push($_cache_info, $this->_cache_info);
$this->_cache_info = array();
$_params = array('tpl_file' => $resource_name, 'cache_id' => $cache_id, 'compile_id' => $compile_id, 'results' => null);
require_once SMARTY_CORE_DIR . 'core.read_cache_file.php';
if (smarty_core_read_cache_file($_params, $this)) {
$_smarty_results = $_params['results'];
if (!empty($this->_cache_info['insert_tags'])) {
$_params = array('plugins' => $this->_cache_info['insert_tags']);
require_once SMARTY_CORE_DIR . 'core.load_plugins.php';
smarty_core_load_plugins($_params, $this);
$_params = array('results' => $_smarty_results);
require_once SMARTY_CORE_DIR . 'core.process_cached_inserts.php';
$_smarty_results = smarty_core_process_cached_inserts($_params, $this);
}
if (!empty($this->_cache_info['cache_serials'])) {
$_params = array('results' => $_smarty_results);
require_once SMARTY_CORE_DIR . 'core.process_compiled_include.php';
$_smarty_results = smarty_core_process_compiled_include($_params, $this);
}
if ($display) {
if ($this->debugging) {
// capture time for debugging info
$_params = array();
require_once SMARTY_CORE_DIR . 'core.get_microtime.php';
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
require_once SMARTY_CORE_DIR . 'core.display_debug_console.php';
$_smarty_results .= smarty_core_display_debug_console($_params, $this);
}
if ($this->cache_modified_check) {
$_server_vars = $this->request_use_auto_globals ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
$_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
$_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']) . ' GMT';
if (@count($this->_cache_info['insert_tags']) == 0 && !$this->_cache_serials && $_gmt_mtime == $_last_modified_date) {
if (php_sapi_name() == 'cgi') {
header('Status: 304 Not Modified');
} else {
header('HTTP/1.1 304 Not Modified');
}
} else {
header('Last-Modified: ' . $_gmt_mtime);
echo $_smarty_results;
}
} else {
echo $_smarty_results;
}
error_reporting($_smarty_old_error_level);
// restore initial cache_info
$this->_cache_info = array_pop($_cache_info);
return true;
} else {
error_reporting($_smarty_old_error_level);
// restore initial cache_info
$this->_cache_info = array_pop($_cache_info);
return $_smarty_results;
//.........这里部分代码省略.........