📄 http.inc.php
字号:
<?php
if(!defined("__CLASS_HTTP__"))
{
define("__CLASS_HTTP__",1);
class Http
{
//不让IE缓存
function noCache()
{
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
}
//设置cookie
//$url为cookie有效路径,如'http://www.163.com/temp/'
//设置虚拟路径即可,比原setcookie()方便
function set_cookie($name, $value, $expire=0, $url='', $secure=0)
{
if (!empty($url))
{
$array = parse_url($url);
if(substr($array['host'], 0, 9) == 'localhost' || preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/i", $array['host']))
{
$cookiedomain = '';
}
else
{
$cookiedomain = str_replace('www', '', $array['host']);
}
$cookiepath = ($array['path'] == '/') ? ('') : ($array['path']);
}
else
{
$cookiedomain = $cookiepath = '';
}
setcookie($name, $value, $expire, $cookiepath, $cookiedomain, $secure);
}
} //end class
}//end if defined
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -