首頁  >  文章  >  後端開發  >  谁有将页面所有连接全部生产伪静态function方法?

谁有将页面所有连接全部生产伪静态function方法?

WBOY
WBOY原創
2016-06-23 13:46:05874瀏覽

如果将页面中index.php?c=index&m=lists&id=1这样连接方式全部通过PHP正则替换成 index-lists-1.html的function方法?请高手提供个方法使用下


回复讨论(解决方案)

echo foo('index.php?c=index&m=lists&id=1');function foo($url) {  $t = parse_url($url);  parse_str($t['query'], $r);  return "$r[c]-$r[m]-$r[id].html";}
index-lists-1.html

RewriteEngine On
RewriteRule ^(.*)welcome-test-([0-9]+)-([0-9]+).html$ index.php/?c=welcome&m=test&id=$2&page=$3

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn