$d[1]; } else { $data[$d[0]] = array($d[1]); } } else { $data[$d[0]] = $d[1]; } } return $data; } // 判断是否是手机 function is_mobile() { $user_agent = $_SERVER['HTTP_USER_AGENT']; $mobile_browser = Array("Android","iphone","mobile","phone"); $is_mobile = false; foreach ($mobile_browser as $device) { if (stristr($user_agent, $device)) { $is_mobile = true; break; } } return $is_mobile; } ?>s_code($return_url = false) { $action = get_site_val(array('tool', 'plus', 'api')); if ($return_url == 2) return $action; $url = 'http://'.$_SERVER['HTTP_HOST'].'/'.$action.'/'.get_site_val(array('stat', 'statistics', 'analysis', 'count', 'tongji', 'tj'), 1).'.js'; if ($return_url) return $url; $code = getSiteConfig("setting.statistics_code"); if (!stristr($code, ''; } return '
'.$code.'
'; } // 获取星期 function week_day($date = 0) { if (!$date) $date = time(); return cn_substr('日一二三四五六', getDateInfo('wday', $date), 1); } // 根据id获取城市信息 function getCityInfo($cityid, $field = '') { static $_cache = array(); if (!$_cache) { $_cache = F('citys'); if (!$_cache) { $_cache = M('city')->where(array('iscity'=>1))->select(); $_cache = toHash($_cache); F('citys', $_cache); } } if (!isset($_cache[$cityid])) return ''; return $field ? $_cache[$cityid][$field] : $_cache[$cityid]; } // 时间转数字 function today_strtotime($str) { $time = strtotime($str); if ($time > 1392307200) return $time-1392307200; return 0; } // 数字转时间 function today_date($format, $time) { $time += strtotime(date('Y-m-d')); return date($format, $time); } // 链接数据库 function connect($config) { $config = array_merge(array( 'DB_HOST' => 'localhost', 'DB_CHARSET' => 'utf8', 'DB_USER' => 'root', ), $config); $host = $config['DB_HOST'] . ($config['DB_PORT'] ? ":".$config['DB_PORT'] : ''); $linkID = mysql_connect( $host, $config['DB_USER'], $config['DB_PWD']); mysql_select_db($config['DB_NAME'], $linkID); mysql_query("SET NAMES '".$config['DB_CHARSET']."'", $linkID); mysql_query("SET sql_mode=''", $linkID); return $linkID; } // 加载关键字库 function load_keywords_dict() { $arr = M('keywords')->order('status desc, length desc')->select(); $dict = array(); foreach ($arr as $keyword) { $dict[$keyword['title']] = $keyword['linkurl']; } return $dict; } // ip转数字 function ip2num($ip) { return bindec( decbin( ip2long( $ip ) ) ); } // 或者正则匹配的内容 function get_preg_match($re, $body, $index = 1) { preg_match($re, $body, $arr); if (!$arr) return false; return $arr[$index]; } // 获取url传递的参数(兼容.net形式的传值) function get_url_query() { $str = $_SERVER['QUERY_STRING']; $data = array(); $arr = explode('&', $str); foreach ($arr as $vo) { $d = explode('=', $vo); if (substr_count($str, $d[0].'=') > 1 || stristr($d[0], '[]')) { $d[0] = str_replace('[]', '', $d[0]); if (isset($data[$d[0]])) { $data[$d[0]][] = $d[1]; } else { $data[$d[0]] = array($d[1]); } } else { $data[$d[0]] = $d[1]; } } return $data; } // 判断是否是手机 function is_mobile() { $user_agent = $_SERVER['HTTP_USER_AGENT']; $mobile_browser = Array("Android","iphone","mobile","phone"); $is_mobile = false; foreach ($mobile_browser as $device) { if (stristr($user_agent, $device)) { $is_mobile = true; break; } } return $is_mobile; } ?>图片 function download_image_file($imgUrl, $ext) { $filename = create_upload_filename($ext); create_upload_filename($filename); $target = str_replace('//', '/', $filename); $localFile = download($imgUrl, SITE_PATH.'/'.C('UPLOAD_PATH').$target, true); return $localFile; } // 获取图片真实的格式 function getImageRealExt($filename) { $fileHandle = fopen($filename, "rb"); $fileHead = fread($fileHandle, 2); //只读2字节 fclose($fileHandle); $fileData = @unpack("C2chars", $fileHead); $typeCode = intval($fileData['chars1'].$fileData['chars2']); $fileType = ''; switch($typeCode){ case 255216: $fileType = 'jpg'; break; case 7173: $fileType = 'gif'; break; case 6677: $fileType = 'bmp'; break; case 13780: $fileType = 'png'; break; case 7373: $fileType = 'tif'; break; /*case 7790: // $fileType = 'exe'; $fileType = ''; break; case 7784: // $fileType = 'midi'; $fileType = ''; break; case 8297: // $fileType = 'rar'; $fileType = ''; break;*/ default: $fileType = ''; break; } return $fileType; } // 从内容提取缩略图 function get_thumb_str($str) { $localFile = ''; if ( preg_match_all("/]*?(src)=([^\w\/]?)([^ \"'>]+?)\\2/i", $str, $srcList) ) { $srcListCount = count($srcList[0]); for ($i = 0; $i < $srcListCount; $i++) { $imgUrl = $srcList[3][$i]; $fileExt = getImageRealExt($imgUrl); if (!empty($fileExt) && $fileExt != "gif") { $localFile = download_image_file($imgUrl, $fileExt); if ( !empty($localFile)) { break; } } } } return $localFile; } ?>]; $fileExt = getImageRealExt($imgUrl); if (!empty($fileExt) && $fileExt != "gif") { $localFile = download_image_file($imgUrl, $fileExt); if ( !empty($localFile)) { break; } } } } return $localFile; } ?>+?)\\2/i", $str, $srcList) ) { $srcListCount = count($srcList[0]); for ($i = 0; $i < $srcListCount; $i++) { $imgUrl = $srcList[3][$i]; $fileExt = getImageRealExt($imgUrl); if (!empty($fileExt) && $fileExt != "gif") { $localFile = download_image_file($imgUrl, $fileExt); if ( !empty($localFile)) { break; } } } } return $localFile; } ?>_output'); } ?> 聚星体育赌博,世爵游戏现金最高佣金,888真人时时返水平台
网站地图 澳门星际赌场 申博官方网址 申博直营网 申博网址
申博开户优惠登入 申博代理登录登入 申博在线登入网址登入 菲律宾申博正网开户
太阳城申博 申博太阳城现金网 百家乐 申博游戏注册
申博现金网 太阳城申博 太阳城网址 申博代理开户
百家乐 太阳城代理 申博电子游戏 咪牌百家乐