= $brandUri || $uri === $brandUriWithSlash) { // 标准化URL,确保以斜杠结尾 if (substr($uri, -1) != '/') { http_location($cfg['weburl'] . $uri . '/', '301'); } // 设置路由参数 $_GET['control'] = $route['control']; $_GET['action'] = $route['action']; return; } } $r = $this->category_url($cfg, $uri); if ($r) { return; } $r = $this->content_url($cfg, $uri); if ($r) { return; } $r = $this->tag_url($cfg, $uri); if ($r) { return; } $r = $this->search_url($cfg, $uri); if ($r) { return; } $r = $this->comment_url($cfg, $uri); if ($r) { return; } $r = $this->index_page_url($cfg, $uri); if ($r) { return; } $r = $this->tag_like_url($cfg, $uri); if ($r) { return; } $r = $this->user_url($cfg, $uri); if ($r) { return; } $r = $this->flags_url($cfg, $uri); if ($r) { return; } $r = $this->space_url($cfg, $uri); if ($r) { return; } $methods = [ 'jinjia', 'zhoudafu', 'laofengxiang', 'zhouliufu', 'zhoushengsheng', 'liufu', 'laomiao', 'jinzhizun', 'caibai', 'zhoudasheng', 'chaohongji', 'baoqing', 'taiyang', 'qilu', 'yayi', 'qianxizhixing', 'jimeng', 'dongxiang', 'cuihua', 'futai', 'chenghuang', 'xingguangda', 'jinlan', 'laiyin', 'jindafu', 'subpage' ]; foreach ($methods as $method) { $methodName = $method . '_url'; if (method_exists($this, $methodName)) { $r = $this->$methodName($cfg, $uri); if ($r) { return; } } } } //伪静态结束------------------------------------------------------------------------------------------------------ // 伪静态时,如果 $uri 有值,但没有解析到相关 $_GET 时,就提示404 if (empty($_GET) && isset($uri) && !empty($uri)) { core::error404(); } if (!isset($_GET['control'])) { $r = $this->other_url(); if ($r) { return; } } } //---------------------------------------------------------------------- 以下是各模块URL解析的具体函数实现 //分类URL解析 protected function category_url($cfg = [], $uri = '') { //分类信息 alias=>cid $cate_arr = array_flip($cfg['cate_arr']); // 分类URL未设置后缀的情况,301重定向到已设置后缀的URL if (isset($cate_arr[$uri])) { http_location($cfg['weburl'] . $uri . $cfg['link_cate_end'], '301'); } $_GET['control'] = 'cate'; $_GET['action'] = 'index'; $len = strlen($cfg['link_cate_end']); //分页首页URL if (substr($uri, -$len) == $cfg['link_cate_end']) { $newurl = substr($uri, 0, -$len); if (isset($cate_arr[$newurl])) { $_GET['cid'] = (int) $cate_arr[$newurl]; return true; } } //分类URL分页的情况 if (strpos($uri, $cfg['link_cate_page_pre']) !== false) { $len = strlen($cfg['link_cate_page_end']); if (substr($uri, -$len) == $cfg['link_cate_page_end']) { $newurl = substr($uri, 0, -$len); $u_arr = explode($cfg['link_cate_page_pre'], $newurl); if (isset($cate_arr[$u_arr[0]])) { $_GET['cid'] = (int) $cate_arr[$u_arr[0]]; //分页 if (isset($u_arr[1])) { if ($this->integer_check($u_arr[1])) { $_GET['page'] = $u_arr[1]; } else { core::error404(); } } return true; } } } unset($_GET['control']); unset($_GET['action']); return false; } //内容URL解析 protected function content_url($cfg = [], $uri = '') { $link_show_end = $cfg['link_show_end']; $link_show_end_len = strlen($link_show_end); $cate_arr = array_flip($cfg['cate_arr']); $newurl = $link_show_end_len ? substr($uri, 0, -$link_show_end_len) : $uri; $_GET['control'] = 'show'; $_GET['action'] = 'index'; //内容分页URL if (stripos($uri, '/page_')) { $link_show_end = $cfg['link_show_end']; $link_show_end_len = strlen($link_show_end); $cate_arr = array_flip($cfg['cate_arr']); $newurl = $link_show_end_len ? substr($uri, 0, -$link_show_end_len) : $uri; $u_arr = explode('/page_', $newurl); if (isset($u_arr[1]) && is_numeric($u_arr[1]) && $u_arr[1] > 0) { $_GET['page'] = $u_arr[1]; $newurl = $u_arr[0]; } unset($u_arr); } switch ($cfg['link_show_type']) { case 1: //数字型 preg_match("/^(\d+)\/(\d+)$/i", $newurl, $mat); if (isset($mat[2])) { $_GET['cid'] = $mat[1]; $_GET['id'] = $mat[2]; return true; } break; case 2: //推荐型 //preg_match("/^(\w+)\/(\d+)$/i", $newurl, $mat); //修改 匹配一个或多个字母数字下划线和连字符 preg_match("/^([\w-]+)\/(\d+)$/i", $newurl, $mat); if (isset($mat[2]) && isset($cate_arr[$mat[1]])) { $_GET['cid'] = $cate_arr[$mat[1]]; $_GET['id'] = $mat[2]; return true; } break; case 3: //别名型 preg_match("/^(\d+)\_(\d+)$/i", $newurl, $mat); //没有设置别名,将用 cid_id 组合 if (isset($mat[2])) { $_GET['cid'] = $mat[1]; $_GET['id'] = $mat[2]; return true; //}elseif( preg_match('/^[a-zA-Z0-9-_]+$/i', $newurl) ) { } elseif (preg_match('/^[\p{L}\p{N}\-_]+$/u', $newurl)) { //新增 \p{L}:这个Unicode属性表示任何种类的字母字符,无论是大写还是小写,来自任何语言。\p{N}:这个Unicode属性表示任何种类的数字字符,包括十进制数、罗马数字等。 $row = $this->only_alias->get($newurl); if (!empty($row)) { $_GET['cid'] = $row['cid']; $_GET['id'] = $row['id']; return true; } } break; case 4: //加密型 $newurl = decrypt($newurl); //解密得到 cid_id preg_match("/^(\d+)\_(\d+)$/i", $newurl, $mat); if (isset($mat[2])) { $_GET['cid'] = $mat[1]; $_GET['id'] = $mat[2]; return true; } break; case 5: //ID型 if ($this->integer_check($newurl)) { $_GET['mid'] = 2; $_GET['id'] = $newurl; return true; } preg_match("/^(\d+)\_(\d+)$/i", $newurl, $mat); if (isset($mat[2])) { if (!$this->mid_check($mat[1], $cfg)) { core::error404(); } $_GET['mid'] = $mat[1]; $_GET['id'] = $mat[2]; return true; } break; case 6: //别名组合型 $u_arr = explode('/', $newurl); if (isset($u_arr[1]) && isset($cate_arr[$u_arr[0]])) { $cid = (int) $cate_arr[$u_arr[0]]; // 如果没有设置别名,将用 cid_id 组合 preg_match("/^(\d+)\_(\d+)$/i", $u_arr[1], $mat); if (isset($mat[2]) && $mat[1] == $cid) { $_GET['cid'] = $mat[1]; $_GET['id'] = $mat[2]; return true; //}elseif(preg_match('/^[a-zA-Z0-9-_]+$/i', $u_arr[1])) { } elseif (preg_match('/^[\p{L}\p{N}\-_]+$/u', $u_arr[1])) { //新增 \p{L}:这个Unicode属性表示任何种类的字母字符,无论是大写还是小写,来自任何语言。\p{N}:这个Unicode属性表示任何种类的数字字符,包括十进制数、罗马数字等。 $row = $this->only_alias->get($u_arr[1]); if (!empty($row) && $row['cid'] == $cid) { $_GET['cid'] = $row['cid']; $_GET['id'] = $row['id']; return true; } } } break; case 7: //灵活型 $quote = preg_quote($cfg['link_show'], '#'); $quote = strtr($quote, [ '\{cid\}' => '(?\d+)', '\{mid\}' => '(?\d+)', '\{id\}' => '(?\d+)', '\{alias\}' => '(?\w+)', '\{cate_alias\}' => '(?\w+)', '\{password\}' => '(?\w+)', '\{ymd\}' => '(?\d{8})', '\{y\}' => '(?\d{4})', '\{m\}' => '(?\d{2})', '\{d\}' => '(?\d{2})', '\{auth_key\}' => '(?\w+)', '\{hashids\}' => '(?\w+)' ]); preg_match('#' . $quote . '#', $uri, $mat); if ($mat) { //用于control验证日期 isset($mat['ymd']) and ($_GET['date_ymd'] = $mat['ymd']); isset($mat['y']) and ($_GET['date_y'] = $mat['y']); isset($mat['m']) and ($_GET['date_m'] = $mat['m']); isset($mat['d']) and ($_GET['date_d'] = $mat['d']); $auth_key = $_ENV['_config']['auth_key']; if (isset($mat['auth_key']) && $mat['auth_key'] != substr(md5($auth_key), 0, 6)) { core::error404(); } if (isset($mat['cid']) && isset($mat['id'])) { // {cid} {id} 合组 $_GET['cid'] = $mat['cid']; $_GET['id'] = $mat['id']; return true; } elseif (isset($mat['mid']) && isset($mat['id']) && $this->mid_check($mat['mid'], $cfg)) { // {mid} {id} 合组 $_GET['mid'] = $mat['mid']; $_GET['id'] = $mat['id']; return true; } elseif (isset($mat['cate_alias']) && isset($mat['id'])) { // {cate_alias} {id} 合组 $_GET['cid'] = isset($cate_arr[$mat['cate_alias']]) ? $cate_arr[$mat['cate_alias']] : 0; empty($_GET['cid']) && core::error404(); $_GET['id'] = $mat['id']; return true; } elseif (isset($mat['password'])) { // {password} $newurl = decrypt($mat['password']); //解密得到 cid_id preg_match("/^(\d+)\_(\d+)$/i", $newurl, $mat); if (isset($mat[2])) { $_GET['cid'] = $mat[1]; $_GET['id'] = $mat[2]; return true; } } elseif (isset($mat['alias'])) { // {alias} preg_match("/^(\d+)\_(\d+)$/i", $mat['alias'], $mat2); //没有设置别名,将用 cid_id 组合 if (isset($mat2[2])) { $_GET['cid'] = $mat2[1]; $_GET['id'] = $mat2[2]; return true; } $row = $this->only_alias->get($mat['alias']); if (!empty($row)) { $_GET['cid'] = $row['cid']; $_GET['id'] = $row['id']; return true; } }elseif( isset($mat['hashids']) ) { // {hashids} $newurl = hashids_decrypt($mat['hashids']);//解密得到 cid id 数组 if(is_array($newurl) && isset($newurl[1])){ $_GET['cid'] = $newurl[0]; $_GET['id'] = $newurl[1]; return true; } } // 比如article/id.html,只能一个文章模型(多模型的不行,没法区分id属于那个模型的),因此丢到最后 if (isset($mat['id']) && $this->integer_check($mat['id'])) { $u_arr = explode('/', $uri); if (substr($cfg['link_show'], 0, strlen($u_arr[0])) == $u_arr[0]) { $_GET['mid'] = 2; $_GET['id'] = $mat['id']; return true; } } } break; case 8: //HashIDS $newurl = hashids_decrypt($newurl); //解密得到 cid id 数组 if (is_array($newurl) && isset($newurl[1])) { $_GET['cid'] = $newurl[0]; $_GET['id'] = $newurl[1]; return true; } break; } unset($_GET['control']); unset($_GET['action']); return false; } //标签URL解析 protected function tag_url($cfg = [], $uri = '') { $len = strlen($cfg['link_tag_pre']); if (substr($uri, 0, $len) == $cfg['link_tag_pre']) { $len2 = strlen($cfg['link_tag_end']); if (substr($uri, -$len2) == $cfg['link_tag_end']) { $_GET['control'] = 'tag'; $_GET['action'] = 'index'; $newurl = substr($uri, $len, -$len2); $u_arr = explode('/', $newurl); //分页 if (isset($u_arr[1])) { $page = $this->page_check($u_arr[1]); if ($page) { $_GET['page'] = $page; } else { core::error404(); } } switch ($cfg['link_tag_type']) { case 0: preg_match('/^(\d+)\_(.+)$/i', $u_arr[0], $mat); if (isset($mat[2])) { if (!$this->mid_check($mat[1], $cfg)) { core::error404(); } $_GET['mid'] = $mat[1]; $_GET['name'] = $mat[2]; return true; } else { $_GET['mid'] = 2; $_GET['name'] = $u_arr[0]; return true; } break; case 1: preg_match("/^(\d+)\_(\d+)$/i", $u_arr[0], $mat); if (isset($mat[2])) { if (!$this->mid_check($mat[1], $cfg)) { core::error404(); } $_GET['mid'] = $mat[1]; $_GET['tagid'] = $mat[2]; return true; } elseif ($this->integer_check($u_arr[0])) { $_GET['mid'] = 2; $_GET['tagid'] = $u_arr[0]; return true; } break; case 2: $newurl = decrypt($u_arr[0]); //解密得到 mid_tagid preg_match("/^(\d+)\_(\d+)$/i", $newurl, $mat); if (isset($mat[2])) { if (!$this->mid_check($mat[1], $cfg)) { core::error404(); } $_GET['mid'] = (int) $mat[1]; $_GET['tagid'] = (int) $mat[2]; return true; } break; case 3: $newurl = hashids_decrypt($u_arr[0]); //解密得到 mid tagid 数组 if (is_array($newurl) && isset($newurl[1])) { $_GET['mid'] = (int) $newurl[0]; $_GET['tagid'] = (int) $newurl[1]; return true; } break; } } else { //尝试301跳转到带后缀的链接试试看~ http_location($cfg['weburl'] . $uri . $cfg['link_tag_end'], '301'); } } unset($_GET['control']); unset($_GET['action']); return false; } //搜索URL解析 protected function search_url($cfg = [], $uri = '') { if (substr($uri, 0, 7) == 'search/') { if (substr($uri, -1) != '/') { $uri .= '/'; } $newurl = substr($uri, 7, -1); $uarr = explode('/', $newurl); //模型ID if (isset($uarr[0]) && substr($uarr[0], 0, 4) == 'mid_') { $mid = substr($uarr[0], 4); if ($this->mid_check($mid, $cfg)) { $_GET['mid'] = $mid; array_shift($uarr); } else { core::error404(); } } else { $_GET['mid'] = 2; } //排除多余的参数 if (count($uarr) > 2) { core::error404(); } //关键词 $_GET['keyword'] = $uarr[0]; //分页 if (isset($uarr[1])) { $page = $this->page_check($uarr[1]); if ($page) { $_GET['page'] = $page; } else { core::error404(); } } $_GET['control'] = 'search'; $_GET['action'] = 'index'; return true; } //搜索页面链接解析 $url_suffix = isset($_ENV['_config']['url_suffix']) ? $_ENV['_config']['url_suffix'] : '.html'; $url_suffix_len = strlen($url_suffix); if (substr($uri, -$url_suffix_len) == $url_suffix && substr($uri, 0, -$url_suffix_len) == 'so') { $_GET['control'] = 'search'; $_GET['action'] = 'so'; return true; } return false; } //评论URL解析 protected function comment_url($cfg = [], $uri = '') { $len = strlen($cfg['link_comment_pre']); if (substr($uri, 0, $len) == $cfg['link_comment_pre']) { $url_suffix = isset($_ENV['_config']['url_suffix']) ? $_ENV['_config']['url_suffix'] : '.html'; $url_suffix_len = strlen($url_suffix); if (substr($uri, -$url_suffix_len) == $url_suffix) { $newurl = substr($uri, $len, -$url_suffix_len); $u_arr = explode('_', $newurl); if (count($u_arr) > 1) { $_GET['control'] = 'comment'; $_GET['action'] = 'index'; $_GET['cid'] = $u_arr[0]; $_GET['id'] = $u_arr[1]; //分页 if (isset($u_arr[2])) { if ($this->integer_check($u_arr[2])) { $_GET['page'] = $u_arr[2]; } else { core::error404(); } } return true; } } } return false; } //首页分页URL解析 protected function index_page_url($cfg = [], $uri = '') { $url_suffix = isset($_ENV['_config']['url_suffix']) ? $_ENV['_config']['url_suffix'] : '.html'; $url_suffix_len = strlen($url_suffix); if (substr($uri, 0, 6) == 'index_' && substr($uri, -$url_suffix_len) == $url_suffix) { $newurl = substr($uri, 0, -$url_suffix_len); preg_match("/^index_(\d+)$/i", $newurl, $mat); if (isset($mat[1])) { if (!$this->integer_check($mat[1])) { core::error404(); } $_GET['control'] = 'index'; $_GET['action'] = 'index'; $_GET['mid'] = 2; $_GET['page'] = $mat[1]; return true; } preg_match("/^index_(\d+)_(\d+)$/i", $newurl, $mat); if (isset($mat[2])) { if (!$this->mid_check($mat[1], $cfg)) { core::error404(); } if (!$this->integer_check($mat[2])) { core::error404(); } $_GET['control'] = 'index'; $_GET['action'] = 'index'; $_GET['mid'] = $mat[1]; $_GET['page'] = $mat[2]; return true; } } return false; } //热门标签 全部标签 URL解析 protected function tag_like_url($cfg = [], $uri = '') { // 热门标签 if ($uri == $cfg['link_tag_top'] || $uri == $cfg['link_tag_top'] . '/') { if ($uri == $cfg['link_tag_top']) { http_location($cfg['weburl'] . $uri . '/', '301'); } $_GET['control'] = 'tag'; $_GET['action'] = 'top'; return true; } //全部标签 if (substr($uri, 0, 8) == 'tag_all/' || substr($uri, 0, 7) == 'tag_all') { if (substr($uri, -1) != '/') { http_location($cfg['weburl'] . $uri . '/', '301'); } $u_arr = explode('/', $uri); if ($u_arr[0] != 'tag_all') { core::error404(); } else { unset($u_arr); } $_GET['control'] = 'tag'; $_GET['action'] = 'all'; $newurl = substr($uri, 8, -1); if ($newurl) { if (is_numeric($newurl) && $newurl > 0) { $_GET['mid'] = 2; $_GET['page'] = $newurl; } else { $u_arr = explode('_', $newurl); if (count($u_arr) > 2) { core::error404(); } if (!$this->mid_check($u_arr[0], $cfg)) { core::error404(); } $_GET['mid'] = $u_arr[0]; if (is_numeric($u_arr[1]) && $u_arr[1] > 0) { $_GET['page'] = $u_arr[1]; } else { core::error404(); } } } return true; } return false; } //用户中心URL解析 protected function user_url($cfg = [], $uri = '') { $url_suffix = isset($_ENV['_config']['url_suffix']) ? $_ENV['_config']['url_suffix'] : '.html'; $url_suffix_len = strlen($url_suffix); $newurl = substr($uri, 0, -$url_suffix_len); if (preg_match('/^user-[a-z0-9-]+$/i', $newurl) || preg_match('/^my-[a-z0-9-]+$/i', $newurl)) { $u_arr = explode('-', $newurl); if (count($u_arr) > 1) { $_GET['control'] = $u_arr[0]; array_shift($u_arr); $_GET['action'] = $u_arr[0]; array_shift($u_arr); $num = count($u_arr); for ($i = 0; $i < $num; $i += 2) { isset($u_arr[$i + 1]) && ($_GET[$u_arr[$i]] = $u_arr[$i + 1]); } return true; } } return false; } //属性内容URL解析 protected function flags_url($cfg = [], $uri = '') { if (substr($uri, 0, 6) == 'flags/') { if (substr($uri, -1) == '/') { $uri = substr($uri, 0, -1); } $u_arr = explode('/', $uri); if (isset($u_arr[1])) { $_GET['control'] = 'flags'; $_GET['action'] = 'index'; $u_arr_1 = explode('_', $u_arr[1]); if (isset($u_arr_1[1])) { $_GET['mid'] = $u_arr_1[0]; if (!$this->mid_check($_GET['mid'], $cfg)) { core::error404(); } $_GET['flag'] = $u_arr_1[1]; } else { $_GET['mid'] = 2; $_GET['flag'] = $u_arr[1]; } if (!isset($this->cms_content->flag_arr[$_GET['flag']])) { core::error404(); } //分页 if (isset($u_arr[2])) { $page = $this->page_check($u_arr[2]); if ($page) { $_GET['page'] = $page; } else { core::error404(); } } return true; } } return false; } //个人空间URL解析 protected function space_url($cfg = [], $uri = '') { $len = strlen($cfg['link_space_pre']); if (substr($uri, 0, $len) == $cfg['link_space_pre']) { if (substr($uri, -1) == $cfg['link_space_end']) { $uri = substr($uri, 0, -1); } $u_arr = explode('/', $uri); if (isset($u_arr[1])) { $_GET['control'] = 'space'; $_GET['action'] = 'index'; $u_arr_1 = explode('_', $u_arr[1]); if (isset($u_arr_1[1])) { $_GET['mid'] = $u_arr_1[0]; if (!$this->mid_check($_GET['mid'], $cfg)) { core::error404(); } $_GET['uid'] = $u_arr_1[1]; } else { $_GET['mid'] = 2; $_GET['uid'] = $u_arr[1]; } //分页 if (isset($u_arr[2])) { $page = $this->page_check($u_arr[2]); if ($page) { $_GET['page'] = $page; } else { core::error404(); } } return true; } } return false; } //动态URL解析 protected function other_url() { if (isset($_GET['u'])) { $u = $_GET['u']; unset($_GET['u']); } elseif (!empty($_SERVER['PATH_INFO'])) { $u = R('PATH_INFO', 'S'); } else { $_GET = []; $u = R('QUERY_STRING', 'S'); } //清除URL后缀 $url_suffix = C('url_suffix'); if ($url_suffix) { $suf_len = strlen($url_suffix); if (substr($u, -$suf_len) == $url_suffix) { $u = substr($u, 0, -$suf_len); } } $uarr = explode('&', $u); $u = $uarr[0]; if (count($uarr) > 1) { array_shift($uarr); foreach ($uarr as $v) { $varr = explode('=', $v); $_GET[$varr[0]] = isset($varr[1]) ? urldecode($varr[1]) : ''; } } unset($uarr); $uarr = explode('-', $u); if (count($uarr) < 2) { core::error404(); } //控制器 if (isset($uarr[0])) { $_GET['control'] = empty($uarr[0]) ? 'index' : strtolower($uarr[0]); array_shift($uarr); } //方法 if (isset($uarr[0])) { $_GET['action'] = empty($uarr[0]) ? 'index' : strtolower($uarr[0]); array_shift($uarr); } //伪静态下 访问动态首页、内容页URL、分类URL、标签URL 则进入404页面 $dis_control = ['index', 'show', 'cate', 'tag']; if (in_array($_GET['control'], $dis_control) && $_GET['action'] == 'index') { core::error404(); } //参数 $num = count($uarr); for ($i = 0; $i < $num; $i += 2) { isset($uarr[$i + 1]) && ($_GET[$uarr[$i]] = $uarr[$i + 1]); } return false; } //分页参数验证 private function page_check($param) { if (empty($param)) { return false; } else { preg_match('/^page_([1-9]\d*)$/', $param, $mat); if (isset($mat[1])) { return $mat[1]; } else { return false; } } } //正整数参数验证 private function integer_check($param) { if (empty($param)) { return false; } elseif (preg_match($this->integer_pattern, $param)) { return true; } else { return false; } } //模型ID验证(不含单页) private function mid_check($mid, $cfg) { if ($mid > 1 && isset($cfg['table_arr'][$mid])) { return true; } else { return false; } } //子页URL解析 protected function subpage_url($cfg = [], $uri = '') { $sub_cid = ['5']; $sub_id = ''; $subpage_link = '-';// 连接符号 $subpage_end = '.html';// 后缀 // 获取当前配置 $cfg = $this->runtime->xget(); $link_show_type = $cfg['link_show_type']; $cate_arr = array_flip($cfg['cate_arr']); // 分类别名=>cid映射 // 根据内容URL类型决定如何获取subpage_pre $use_dynamic_pre = in_array($link_show_type, [6]); // 别名组合型(6) if ($use_dynamic_pre) { // 从URI中提取分类别名作为subpage_pre $uri_parts = explode('/', $uri); $subpage_pre = $uri_parts[0]; // 获取第一个路径部分作为分类别名 // 验证这个分类别名是否存在 if (!isset($cate_arr[$subpage_pre])) { return false; } // 计算前缀长度(分类别名长度+1,因为有一个斜杠) $subpage_pre_length = strlen($subpage_pre) + 1; } else { $subpage_pre = 'post'; $subpage_pre_length = strlen($subpage_pre) + 1; // 检查预设的前缀是否存在 if (empty($subpage_pre) || strpos($uri, $subpage_pre) === false) { return false; } } // 判断后缀是否匹配 if (strpos($uri, $subpage_end) !== false) { // 去掉前缀和后缀 $uri = substr($uri, $subpage_pre_length); $len = strlen($subpage_end); $uri = substr($uri, 0, -$len); $_GET['control'] = 'subpage'; $_GET['action'] = 'index'; // 根据内容URL类型处理不同格式 if ($link_show_type == 3 || $link_show_type == 6) { // 别名型或别名组合型处理 // sid后置格式: 别名+sid $u_arr = $subpage_link ? explode('-', $uri) : explode('_', $uri); if (count($u_arr) == 2) { $alias = $u_arr[0]; $sid = $u_arr[1]; // 通过别名获取文章信息 $row = $this->only_alias->get($alias); if (!empty($row)) { $_GET['cid'] = $row['cid']; $_GET['id'] = $row['id']; $_GET['sid'] = $sid; // 检查是否在指定分类或文章列表中 if (in_array($row['cid'], $sub_cid)) { return true; } } } } else { // 非别名型处理 (保持原逻辑) if ($use_dynamic_pre) { // 推荐型或别名组合型:分类别名已作为subpage_pre // sid后置格式: id+sid $u_arr = $subpage_link ? explode('-', $uri) : explode('_', $uri); if (count($u_arr) == 2) { $_GET['cid'] = $cate_arr[$subpage_pre]; // 从分类别名获取cid $_GET['id'] = $u_arr[0]; $_GET['sid'] = $u_arr[1]; // 检查是否在指定分类或文章列表中 if (in_array($_GET['cid'], $sub_cid)) { return true; } } } else { // 其他类型:使用插件预设的URL格式 // sid后置格式: cid+id+sid $u_arr = $subpage_link ? explode('-', $uri) : explode('_', $uri); if (count($u_arr) == 3) { $_GET['cid'] = $u_arr[0]; $_GET['id'] = $u_arr[1]; $_GET['sid'] = $u_arr[2]; // 检查是否在指定分类或文章列表中 if (in_array($_GET['cid'], $sub_cid)) { return true; } } } } } // 如果不符合任何条件,清除设置的GET参数 unset($_GET['control']); unset($_GET['action']); unset($_GET['cid']); unset($_GET['id']); unset($_GET['sid']); return false; } // jinjiaURL解析 protected function jinjia_url($cfg = array(), $uri = '') { if(substr($uri, 0, 7) == 'jinjia/') { if(substr($uri, -1) != '/') { $uri .= '/'; } $newurl = substr($uri, 7, -1); $uarr = explode('/', $newurl); // 模型ID if(isset($uarr[0]) && substr($uarr[0], 0 ,4) == 'mid_') { $mid = substr($uarr[0], 4); if($this->mid_check($mid, $cfg)) { $_GET['mid'] = $mid; array_shift($uarr); } else { core::error404(); } } else { $_GET['mid'] = 2; } // 排除多余的参数 if(count($uarr) > 2) { core::error404(); } // 关键词 $_GET['corewords'] = $uarr[0]; // 新增 关键词不是以.html结尾则跳转404 if (substr($uarr[0], -5) !== '.html') { core::error404(); } // 分页 if( isset($uarr[1]) ) { $page = $this->page_check($uarr[1]); if($page) { $_GET['page'] = $page; } else { core::error404(); } } $_GET['control'] = 'jinjia'; $_GET['action'] = 'page'; return true; } return false; } // 品牌列表 private $supportedBrands = [ 'zhoudafu', 'laofengxiang', 'zhouliufu', 'zhoushengsheng', 'liufu', 'laomiao', 'jinzhizun', 'caibai', 'zhoudasheng', 'chaohongji', 'baoqing', 'taiyang', 'qilu', 'yayi', 'qianxizhixing', 'jimeng', 'dongxiang', 'cuihua', 'futai', 'chenghuang', 'xingguangda', 'jinlan', 'laiyin', 'jindafu' ]; /** * 统一品牌路由解析 */ protected function brand_route($cfg, $uri) { foreach ($this->supportedBrands as $brand) { $prefix = $brand . '/'; if (substr($uri, 0, strlen($prefix)) == $prefix) { // 标准化URI if (substr($uri, -1) != '/') { $uri .= '/'; } $newurl = substr($uri, strlen($prefix), -1); $uarr = explode('/', $newurl); // 处理模型ID if (isset($uarr[0]) && substr($uarr[0], 0, 4) == 'mid_') { $mid = substr($uarr[0], 4); if ($this->mid_check($mid, $cfg)) { $_GET['mid'] = $mid; array_shift($uarr); } else { core::error404(); } } else { $_GET['mid'] = 2; } // 参数检查 if (count($uarr) > 2) { core::error404(); } // 处理关键词 if (!isset($uarr[0]) || substr($uarr[0], -5) !== '.html') { core::error404(); } $_GET['corewords'] = $uarr[0]; // 处理分页 if (isset($uarr[1])) { $page = $this->page_check($uarr[1]); if ($page) { $_GET['page'] = $page; } else { core::error404(); } } // 设置路由参数 $_GET['control'] = 'pinpai'; $_GET['action'] = $brand; return true; } } return false; } protected function zhoudafu_url($cfg, $uri) { if (substr($uri, 0, 9) == 'zhoudafu/') { return $this->brand_route($cfg, $uri); } return false; } protected function laofengxiang_url($cfg, $uri) { if (substr($uri, 0, 13) == 'laofengxiang/') { return $this->brand_route($cfg, $uri); } return false; } protected function zhouliufu_url($cfg, $uri) { if (substr($uri, 0, 10) == 'zhouliufu/') { return $this->brand_route($cfg, $uri); } return false; } protected function zhoushengsheng_url($cfg, $uri) { if (substr($uri, 0, 15) == 'zhoushengsheng/') { return $this->brand_route($cfg, $uri); } return false; } protected function liufu_url($cfg, $uri) { if (substr($uri, 0, 6) == 'liufu/') { return $this->brand_route($cfg, $uri); } return false; } protected function laomiao_url($cfg, $uri) { if (substr($uri, 0, 8) == 'laomiao/') { return $this->brand_route($cfg, $uri); } return false; } protected function jinzhizun_url($cfg, $uri) { if (substr($uri, 0, 10) == 'jinzhizun/') { return $this->brand_route($cfg, $uri); } return false; } protected function caibai_url($cfg, $uri) { if (substr($uri, 0, 7) == 'caibai/') { return $this->brand_route($cfg, $uri); } return false; } protected function zhoudasheng_url($cfg, $uri) { if (substr($uri, 0, 12) == 'zhoudasheng/') { return $this->brand_route($cfg, $uri); } return false; } protected function chaohongji_url($cfg, $uri) { if (substr($uri, 0, 11) == 'chaohongji/') { return $this->brand_route($cfg, $uri); } return false; } protected function baoqing_url($cfg, $uri) { if (substr($uri, 0, 8) == 'baoqing/') { return $this->brand_route($cfg, $uri); } return false; } protected function taiyang_url($cfg, $uri) { if (substr($uri, 0, 8) == 'taiyang/') { return $this->brand_route($cfg, $uri); } return false; } protected function qilu_url($cfg, $uri) { if (substr($uri, 0, 5) == 'qilu/') { return $this->brand_route($cfg, $uri); } return false; } protected function yayi_url($cfg, $uri) { if (substr($uri, 0, 5) == 'yayi/') { return $this->brand_route($cfg, $uri); } return false; } protected function qianxizhixing_url($cfg, $uri) { if (substr($uri, 0, 14) == 'qianxizhixing/') { return $this->brand_route($cfg, $uri); } return false; } protected function jimeng_url($cfg, $uri) { if (substr($uri, 0, 7) == 'jimeng/') { return $this->brand_route($cfg, $uri); } return false; } protected function dongxiang_url($cfg, $uri) { if (substr($uri, 0, 10) == 'dongxiang/') { return $this->brand_route($cfg, $uri); } return false; } protected function cuihua_url($cfg, $uri) { if (substr($uri, 0, 7) == 'cuihua/') { return $this->brand_route($cfg, $uri); } return false; } protected function futai_url($cfg, $uri) { if (substr($uri, 0, 6) == 'futai/') { return $this->brand_route($cfg, $uri); } return false; } protected function chenghuang_url($cfg, $uri) { if (substr($uri, 0, 11) == 'chenghuang/') { return $this->brand_route($cfg, $uri); } return false; } protected function xingguangda_url($cfg, $uri) { if (substr($uri, 0, 12) == 'xingguangda/') { return $this->brand_route($cfg, $uri); } return false; } protected function jinlan_url($cfg, $uri) { if (substr($uri, 0, 7) == 'jinlan/') { return $this->brand_route($cfg, $uri); } return false; } protected function laiyin_url($cfg, $uri) { if (substr($uri, 0, 7) == 'laiyin/') { return $this->brand_route($cfg, $uri); } return false; } protected function jindafu_url($cfg, $uri) { if (substr($uri, 0, 8) == 'jindafu/') { return $this->brand_route($cfg, $uri); } return false; } } Toolcms 5.0.1 错误

错误信息

  • 消息: [程序异常] : 类 parseurl_control 不存在
  • 文件: /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/core.class.php
  • 位置: 第123行

错误位置

    #119        } elseif (is_file(FRAMEWORK_PATH . 'ext/network/' . $classname . '.php')) {
    #120            include FRAMEWORK_PATH . 'ext/network/' . $classname . '.php';
    #121        } else {
    #122            if (!defined('VENDOR')) {
    #123                throw new Exception("类 $classname 不存在");
    #124            }
    #125        }
    #126        DEBUG && ($_ENV['_include'][] = $classname . ' 类');
    #127        return class_exists($classname, false);
    #128    }

基本信息

  • 模型: /www/wwwroot/huangjin.suloon.com/toolcms/model/
  • 视图: /www/wwwroot/huangjin.suloon.com/theme/default/
  • 控制器: /www/wwwroot/huangjin.suloon.com/toolcms/control/_control.class.php
  • 日志目录: /www/wwwroot/huangjin.suloon.com/runtime/logs/

程序流程

  • #0 [internal function]: core::autoload_handler()
  • #1 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/core.class.php(208): spl_autoload_call()
  • #2 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/core.class.php(134): core::parseurl_control()
  • #3 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/core.class.php(12): core::init_get()
  • #4 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/xiunophp.php(102): core::init_start()
  • #5 /www/wwwroot/huangjin.suloon.com/index.php(27): require('/www/wwwroot/hu...')
  • #6 {main}

SQL

    $_GET

    • #rewrite => tag/黄金td历史行情/tencent:/message/

    $_POST

      $_COOKIE

        包含文件

        • #0 /www/wwwroot/huangjin.suloon.com/index.php
        • #1 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/xiunophp.php
        • #2 /www/wwwroot/huangjin.suloon.com/toolcms/config/config.inc.php
        • #3 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/base.func.php
        • #4 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/core.class.php
        • #5 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/debug.class.php
        • #6 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/log.class.php
        • #7 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/model.class.php
        • #8 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/theme.class.php
        • #9 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/lib/control.class.php
        • #10 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/db/db.interface.php
        • #11 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/db/db_pdo_mysql.class.php
        • #12 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/cache/cache.interface.php
        • #13 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/cache/cache_memcache.class.php
        • #14 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/ext/network/Network__interface.php
        • #15 /www/wwwroot/huangjin.suloon.com/toolcms/config/plugin.inc.php
        • #16 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/ads/conf.php
        • #17 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/art_url/conf.php
        • #18 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/cfg_extend/conf.php
        • #19 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/database/conf.php
        • #20 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/editor_ue/conf.php
        • #21 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/links/conf.php
        • #22 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/log/conf.php
        • #23 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/models_filed/conf.php
        • #24 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/tool_exchange/conf.php
        • #25 /www/wwwroot/huangjin.suloon.com/toolcms/plugin/tool_sitemaps_pro/conf.php
        • #26 /www/wwwroot/huangjin.suloon.com/runtime/misc.func.php
        • #27 /www/wwwroot/huangjin.suloon.com/runtime/core_lang/zh-cn.php
        • #28 /www/wwwroot/huangjin.suloon.com/runtime/lang/zh-cn.php
        • #29 /www/wwwroot/huangjin.suloon.com/runtime/toolcms_control/parseurl_control.class.php
        • #30 /www/wwwroot/huangjin.suloon.com/toolcms/xiunophp/tpl/exception.php

        其他信息

        • 请求路径: /tag/%E9%BB%84%E9%87%91td%E5%8E%86%E5%8F%B2%E8%A1%8C%E6%83%85/tencent:/message/?Site=huangjin.suloon.com&uin=1430457151
        • 当前时间: 2026-04-26 03:39:58
        • 当前网协: 10.2.173.147
        • 运行时间: 0.3930
        • 内存开销: 855.1 KB
          Toolcms 5.0.1