Home > Backend Development > PHP Tutorial > 【80分】求一php正则替换函数和.htaccess伪静态规则

【80分】求一php正则替换函数和.htaccess伪静态规则

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:21:45
Original
1087 people have browsed it


 5   
首页 
上一页 
1

类似的内容替换成,如下
 5   
首页
上一页
1 

注意:
当page不是0的时候伪静态成
/tag-关于友谊珍贵的格言/23/

当page=0的时候伪静态成
/tag-关于友谊珍贵的格言/


【.htaccess伪静态规则】
/e/tags/index.php?page=23&tagname=%B9%D8%D3%DA%D3%D1%D2%EA%D5%E4%B9%F3%B5%C4%B8%F1%D1%D4&line=3&tempid=13

当page不是0的时候伪静态成
/tag-%B9%D8%D3%DA%D3%D1%D2%EA%D5%E4%B9%F3%B5%C4%B8%F1%D1%D4/23/

当page=0的时候伪静态成
/tag-%B9%D8%D3%DA%D3%D1%D2%EA%D5%E4%B9%F3%B5%C4%B8%F1%D1%D4/


回复讨论(解决方案)

大佬们呢???

新手学习 ,同求..................等大神出现。

/tag-(.*?)/((\d+?)/)?  /e/tags/index.php?page=$3&tagname=$1&line=3&tempid=13
Copy after login


5
首页
上一页
1

类似的内容替换成,如下
5
首页
上一页
1

注意:
当page不是0的时候伪静态成
/tag-关于友谊珍贵的格言/23/

当page=0的时候伪静态成
/tag-关于友谊珍贵的格言/


【.htaccess伪静态规则】
/e/tags/index.php?page=23&tagname=%B9%D8%D3%DA%D3%D1%D2%EA%D5%E4%B9%F3%B5%C4%B8%F1%D1%D4&line=3&tempid=13

当page不是0的时候伪静态成
/tag-%B9%D8%D3%DA%D3%D1%D2%EA%D5%E4%B9%F3%B5%C4%B8%F1%D1%D4/23/

当page=0的时候伪静态成
/tag-%B9%D8%D3%DA%D3%D1%D2%EA%D5%E4%B9%F3%B5%C4%B8%F1%D1%D4/

\/tag-(.*?)\/((\d+?)\/)?  /e/tags/index.php?page=$3&tagname=$1&line=3&tempid=13
Copy after login

大致的正则,自己根据自己的环境再调调

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template