发布时间:2025-09-17
更改分页url
xxx.com/xx/
xxx.com/xx/list_2.html
手动改的话
zb_system\function\lib\urlrule.php
public function Make()
{
global $zbp;
$url = $this->GetPreUrl();
$route = $this->GetRoute();
$only_match_page = GetValueInArray($route, 'only_match_page', false);
$forceDisplayFirstPage = $this->forceDisplayFirstPage;
$useAbbr = $this->useAbbr;
if (!empty($route)) {
if (isset($route['abbr_url'])) {
$useAbbr = (bool) $route['abbr_url'];
}
if (isset($route['force_display_firstpage'])) {
$forceDisplayFirstPage = (bool) $route['force_display_firstpage'];
}
}
if (isset($this->Rules['{%page%}'])) {
if ($this->Rules['{%page%}'] == '1' || $this->Rules['{%page%}'] == '0') {
//如果强制显示第一页为假和只匹配带page参数的条件为假
if ($forceDisplayFirstPage == false && $only_match_page == false) {
$this->Rules['{%page%}'] = '';
}
}
} else {
$this->Rules['{%page%}'] = '';
}
//处理之前Active的过程
if (strpos($url, '{&') !== false) {
//$url = str_ireplace('{&', '&', $url);
//$url = str_ireplace('=%', '={%', $url);
$url = preg_replace_callback("|{&([^=]+)\=%|", "UrlRule::preg_replace_helper", $url);
}
//如果没有page页,就删除{%page%}
if ($this->Rules['{%page%}'] == '' && strpos($url, '{%page%}') !== false) {
if (stripos($url, 'list_{%page%}.html') !== false) {
$url = str_replace('list_{%page%}.html', '{%page%}', $url);
} elseif (stripos($url, '_{%page%}') !== false) {
public static function OutputUrlRegEx_Route($route, $keepPage = false)
{
global $zbp;
$match_with_page = $keepPage;
$useAbbr = (bool) GetValueInArray($route, 'abbr_url', false);
$newargs = self::ProcessParameters($route);
$orginUrl = $url = $route['urlrule'];
if ($match_with_page == false && strpos($url, '{%page%}') !== false) {
if (stripos($url, 'list_{%page%}.html') !== false) {
$url = str_replace('list_{%page%}.html', '{%page%}', $url);
}elseif (stripos($url, '_{%page%}') !== false) {
$url = str_replace('_{%page%}', '{%page%}', $url);
} elseif (stripos($url, '/{%page%}') !== false) {
发表评论
留言: