<?php include_once "functions.php"; $tel = urlencode($_GET["tel"]); $url = "http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=" . $tel; $content = html_get($url); $name = getXmlValue($content, "carrier:'", "'"); $res = array("carrier" => iconv("gbk", "utf8", $name)); echo json_encode($res);
/** * 检查静态HTML文件是否有效 * 如果无效需要重新更新 * @access public * @param string $cacheFile 静态文件名 * @param integer $cacheTime 缓存有效期 * @return boolen */ public static function checkHTMLCache($cacheFile = '', $cacheTime = '') { //[cluster] 读取静态文件 $content = html_get($cacheFile); if (!$content) { return false; } $mtime = substr($content, 0, 10); self::$html_content = substr($content, 10); if (filemtime(C('TEMPLATE_NAME')) > $mtime) { // 模板文件如果更新静态文件需要更新 return false; } elseif (!is_numeric($cacheTime) && function_exists($cacheTime)) { return $cacheTime($cacheFile); } elseif ($cacheTime != 0 && NOW_TIME > $mtime + $cacheTime) { // 文件是否在有效期 return false; } //静态文件有效 return true; }
function calendar() { //--- FETCH posted year and month use current if none given $year = html_get('year', date('Y')); $month = html_get('month', date('m')); //--- Validate month and year if (!preg_match('/^20[0-9]{1,2}$/', $year)) { $year = date('Y'); } if (!preg_match('/^(0*)([1-9]|10|11|12)$/', $month)) { $month = date('m'); } //--- Process action if any given $action = html_get('action'); switch ($action) { case '+1': true; $time = mktime(0, 0, 0, $month + 1, 1, $year); $year = date('Y', $time); $month = date('m', $time); break; case '-1': $time = mktime(0, 0, 0, $month - 1, 1, $year); $year = date('Y', $time); $month = date('m', $time); break; default: break; } $this->set_year($year); $this->set_month($month); $this->init(); }