代码拉取完成,页面将自动刷新
<?php
header("Content-type:text/html;charset:utf-8");
/*获取当前访问用户IP*/
function GetIP()
{
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) {
$ip = getenv("HTTP_CLIENT_IP");
} else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) {
$ip = getenv("HTTP_X_FORWARDED_FOR");
} else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) {
$ip = getenv("REMOTE_ADDR");
} else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) {
$ip = $_SERVER['REMOTE_ADDR'];
} else {
$ip = "unknown";
}
return ($ip);
}
/*格式化header*/
function parseHeaders($headers)
{
$head = array();
foreach ($headers as $k => $v) {
$t = explode(':', $v, 2);
if (isset($t[1])) {
$head[trim($t[0])] = trim($t[1]);
} else {
$head[] = $v;
if (preg_match('/HTTP\/[0-9\.]+\s+([0-9]+)/', $v, $out)) {
$head['reponse_code'] = intval($out[1]);
}
}
}
return $head;
}
/*数组格式化输出header*/
function dumpout($vars, $label = '', $return = false)
{
if (!isset($vars)) return false;
$vars = parseHeaders($vars);
if (ini_get('html_errors')) {
$content = "<pre>\n";
if ($label != '') {
$content .= "<strong>{$label} :</strong>\n";
}
$content .= htmlspecialchars(print_r($vars, true));
$content .= "\n</pre>\n";
} else {
$content = $label . " :\n" . print_r($vars, true);
}
if ($return) {
return $content;
}
echo $content;
return null;
}
/*数组格式化输出arr*/
function dumpArr($vars, $label = '', $return = false)
{
if (ini_get('html_errors')) {
$content = "<pre>\n";
if ($label != '') {
$content .= "<strong>{$label} :</strong>\n";
}
$content .= htmlspecialchars(print_r($vars, true));
$content .= "\n</pre>\n";
} else {
$content = $label . " :\n" . print_r($vars, true);
}
if ($return) {
return $content;
}
echo $content;
return null;
}
/**
* @return string:返回当前主机
* 返回当前主机http:// /形式
*/
function getHost()
{
$host = $_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : 'localhost';
return 'http://' . $host . '/';
}
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。