本文整理汇总了PHP中gzip_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP gzip_enabled函数的具体用法?PHP gzip_enabled怎么用?PHP gzip_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gzip_enabled函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert_query_info
/**
* 获得查询次数以及查询时间
*
* @access public
* @return string
*/
function insert_query_info()
{
if ($GLOBALS['db']->queryTime == '') {
$query_time = 0;
} else {
if (PHP_VERSION >= '5.0.0') {
$query_time = number_format(microtime(true) - $GLOBALS['db']->queryTime, 6);
} else {
list($now_usec, $now_sec) = explode(' ', microtime());
list($start_usec, $start_sec) = explode(' ', $GLOBALS['db']->queryTime);
$query_time = number_format($now_sec - $start_sec + ($now_usec - $start_usec), 6);
}
}
/* 内存占用情况 */
if ($GLOBALS['_LANG']['memory_info'] && function_exists('memory_get_usage')) {
$memory_usage = sprintf($GLOBALS['_LANG']['memory_info'], memory_get_usage() / 1048576);
} else {
$memory_usage = '';
}
/* 是否启用了 gzip */
$gzip_enabled = gzip_enabled() ? $GLOBALS['_LANG']['gzip_enabled'] : $GLOBALS['_LANG']['gzip_disabled'];
$online_count = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('sessions'));
/* 加入触发cron代码 */
$cron_method = empty($GLOBALS['_CFG']['cron_method']) ? '<img src="api/cron.php?t=' . gmtime() . '" alt="" style="width:0px;height:0px;" />' : '';
return sprintf($GLOBALS['_LANG']['query_info'], $GLOBALS['db']->queryCount, $query_time, $online_count) . $gzip_enabled . $memory_usage . $cron_method;
}
示例2: insert_query_info
/**
* 获得查询次数以及查询时间
*
* @access public
* @return string
*/
function insert_query_info()
{
if (M()->queryTime == '') {
$query_time = 0;
} else {
if (PHP_VERSION >= '5.0.0') {
$query_time = number_format(microtime(true) - M()->queryTime, 6);
} else {
list($now_usec, $now_sec) = explode(' ', microtime());
list($start_usec, $start_sec) = explode(' ', M()->queryTime);
$query_time = number_format($now_sec - $start_sec + ($now_usec - $start_usec), 6);
}
}
/* 内存占用情况 */
if (L('memory_info') && function_exists('memory_get_usage')) {
$memory_usage = sprintf(L('memory_info'), memory_get_usage() / 1048576);
} else {
$memory_usage = '';
}
/* 是否启用了 gzip */
$gzip_enabled = gzip_enabled() ? L('gzip_enabled') : L('gzip_disabled');
$online_count = M()->table('sessions')->field('COUNT(*)')->getOne();
/* 加入触发cron代码 */
$cron_method = C('cron_method');
$cron_method = empty($cron_method) ? '<img src="api/cron.php?t=' . gmtime() . '" alt="" style="width:0px;height:0px;" />' : '';
return sprintf(L('query_info'), M()->queryCount, $query_time, $online_count) . $gzip_enabled . $memory_usage . $cron_method;
}
示例3: assign_query_info
/**
* 获得查询时间和次数,并赋值给smarty
*
* @access public
* @return void
*/
function assign_query_info()
{
if ($GLOBALS['db']->queryTime == '') {
$query_time = 0;
} else {
if (PHP_VERSION >= '5.0.0') {
$query_time = number_format(microtime(true) - $GLOBALS['db']->queryTime, 6);
} else {
list($now_usec, $now_sec) = explode(' ', microtime());
list($start_usec, $start_sec) = explode(' ', $GLOBALS['db']->queryTime);
$query_time = number_format($now_sec - $start_sec + ($now_usec - $start_usec), 6);
}
}
$GLOBALS['smarty']->assign('query_info', sprintf($GLOBALS['_LANG']['query_info'], $GLOBALS['db']->queryCount, $query_time));
/* 内存占用情况 */
if ($GLOBALS['_LANG']['memory_info'] && function_exists('memory_get_usage')) {
$GLOBALS['smarty']->assign('memory_info', sprintf($GLOBALS['_LANG']['memory_info'], memory_get_usage() / 1048576));
}
/* 是否启用了 gzip */
$gzip_enabled = gzip_enabled() ? $GLOBALS['_LANG']['gzip_enabled'] : $GLOBALS['_LANG']['gzip_disabled'];
$GLOBALS['smarty']->assign('gzip_enabled', $gzip_enabled);
}
示例4: ecs_header
} else {
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
/* 管理员登录后可在任何页面使用 act=phpinfo 显示 phpinfo() 信息 */
if ($_REQUEST['act'] == 'phpinfo' && function_exists('phpinfo')) {
phpinfo();
exit;
}
//header('Cache-control: private');
header('content-type: text/html; charset=' . EC_CHARSET);
header('Expires: Fri, 14 Mar 1980 20:53:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
if ((DEBUG_MODE & 1) == 1) {
error_reporting(E_ALL);
} else {
error_reporting(E_ALL ^ E_NOTICE);
}
if ((DEBUG_MODE & 4) == 4) {
include ROOT_PATH . 'includes/lib.debug.php';
}
/* 判断是否支持gzip模式 */
if (gzip_enabled()) {
ob_start('ob_gzhandler');
} else {
ob_start();
}
示例5: intval
$sql = 'SELECT user_id, user_name, password ' . ' FROM ' . $ecs->table('users') . " WHERE user_id = '" . intval($_COOKIE['ECS']['user_id']) . "' AND password = '" . $_COOKIE['ECS']['password'] . "'";
$row = $db->GetRow($sql);
if (!$row) {
// 没有找到这个记录
$time = time() - 3600;
setcookie("ECS[user_id]", '', $time, '/');
setcookie("ECS[password]", '', $time, '/');
} else {
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['user_name'] = $row['user_name'];
update_user_info();
}
}
if (isset($smarty)) {
$smarty->assign('ecs_session', $_SESSION);
}
}
if ((DEBUG_MODE & 1) == 1) {
error_reporting(E_ALL);
} else {
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
}
if ((DEBUG_MODE & 4) == 4) {
include ROOT_PATH . 'includes/lib.debug.php';
}
/* 判断是否支持 Gzip 模式 */
if (!defined('INIT_NO_SMARTY') && gzip_enabled()) {
ob_start('ob_gzhandler');
} else {
ob_start();
}
示例6: ecshop_init
protected function ecshop_init()
{
header('Cache-control: private');
header('Content-type: text/html; charset=utf-8');
$shop_closed = C('shop_closed');
if (!empty($shop_closed)) {
$close_comment = C('close_comment');
$close_comment = empty($close_comment) ? 'closed.' : $close_comment;
exit($close_comment);
}
//NULL
// 初始化session
self::$sess = new EcsSession(self::$db, self::$ecs->table('sessions'), self::$ecs->table('sessions_data'), 'ecsid');
define('SESS_ID', self::$sess->get_session_id());
// 创建 Smarty 对象
self::$view = new EcsTemplate();
self::$view->cache_lifetime = C('cache_time');
self::$view->template_dir = ROOT_PATH . 'themes/' . C('template');
self::$view->cache_dir = ROOT_PATH . 'data/cache/caches';
self::$view->compile_dir = ROOT_PATH . 'data/cache/compiled';
if ((DEBUG_MODE & 2) == 2) {
self::$view->direct_output = true;
self::$view->force_compile = true;
} else {
self::$view->direct_output = false;
self::$view->force_compile = false;
}
self::$view->caching = true;
// 会员信息
self::$user = init_users();
if (empty($_SESSION['user_id'])) {
if (self::$user->get_cookie()) {
// 如果会员已经登录并且还没有获得会员的帐户余额、积分以及优惠券
if ($_SESSION['user_id'] > 0 && !isset($_SESSION['user_money'])) {
model('Users')->update_user_info();
}
} else {
$_SESSION['user_id'] = 0;
$_SESSION['user_name'] = '';
$_SESSION['email'] = '';
$_SESSION['user_rank'] = 0;
$_SESSION['discount'] = 1.0;
}
}
// 判断是否支持gzip模式
if (gzip_enabled()) {
ob_start('ob_gzhandler');
}
// 设置推荐会员
if (isset($_GET['u'])) {
set_affiliate();
}
// session不存在,检查cookie
if (!empty($_COOKIE['ECS']['user_id']) && !empty($_COOKIE['ECS']['password'])) {
// 找到cookie,验证信息
$where['user_id'] = $_COOKIE['ECS']['user_id'];
$where['password'] = $_COOKIE['ECS']['password'];
$row = $this->model->table('users')->field('user_id, user_name, password')->where($where)->find();
if ($row) {
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['user_name'] = $row['user_name'];
model('Users')->update_user_info();
} else {
// 没有找到这个记录
$time = time() - 3600;
setcookie("ECS[user_id]", '', $time, '/');
setcookie("ECS[password]", '', $time, '/');
}
}
// search 关键词
$search_keywords = C('search_keywords');
if (!empty($search_keywords) && is_string($search_keywords)) {
$keywords = explode(',', $search_keywords);
$this->assign('hot_search_keywords', $keywords);
}
// 模板替换
defined('__TPL__') or define('__TPL__', __ROOT__ . '/themes/' . C('template'));
$stylename = C('stylename');
if (!empty($stylename)) {
$this->assign('ectouch_css_path', __ROOT__ . '/themes/' . C('template') . '/css/ectouch_' . C('stylename') . '.css');
} else {
$this->assign('ectouch_css_path', __ROOT__ . '/themes/' . C('template') . '/css/ectouch.css');
}
}
示例7: assign_query_info
/**
* 获得查询时间和次数,并赋值给smarty
*
* @access public
* @return void
*/
function assign_query_info() {
if (M()->queryTime == '') {
$query_time = 0;
} else {
$query_time = number_format(microtime(true) - M()->queryTime, 6);
}
ECTouch::view()->assign('query_info', sprintf(L('query_info'), M()->queryCount, $query_time));
/* 内存占用情况 */
if (L('memory_info') && function_exists('memory_get_usage')) {
ECTouch::view()->assign('memory_info', sprintf(L('memory_info'), memory_get_usage() / 1048576));
}
/* 是否启用了 gzip */
$gzip_enabled = gzip_enabled() ? L('gzip_enabled') : L('gzip_disabled');
ECTouch::view()->assign('gzip_enabled', $gzip_enabled);
}