多用户商城网站,网站的主机选择,seo关键词优化排名推广,网站如何生成二维码在我们实际开发中#xff0c;有需要#xff0c;不希望使用真静态#xff0c;但是希望利于SEO, 可以考虑使用伪静态。 http://localhost/news.php?typemusicid100 我们希望这个地址可以用下面的访问url来替换 http://localhost/new-music-id100.html 上面的问题可以使用…在我们实际开发中有需要不希望使用真静态但是希望利于SEO, 可以考虑使用伪静态。 http://localhost/news.php?typemusicid100 我们希望这个地址可以用下面的访问url来替换 http://localhost/new-music-id100.html 上面的问题可以使用伪静态 1. 实现方式有 直接使用正则表达式。 2. 使用apahce自带的rewrite机制来完成。 看一个需求 http://localhost/news.php/1,23,456.html, 问这个页面是否给已被访问到 Answer: 答案是可以被访问到可以查看$_SERVER变量中的PATH_INFO 现在希望上面的地址换成下面的地址 http://localhost/news.php?a1b122c219 ?php//http://localhost/bigwebsite/staticPage/fa/demo.php/1,23,456.html//通过$_SERVER[PATH_INFO]可以得到1,23,456.html$path_info $_SERVER[PATH_INFO];//观察1,23,456.html写出正则表达式$reg /(\d),(\d),(\d)\.html$/i;preg_match($reg, $path_info, $res);echo pre;print_r($res);echo /pre;/*Array([0] 1,23,456.html[1] 1[2] 23[3] 456)*///取出所有捕获的子表达式然后进行url的拼接即可//http://localhost/news.php?a$res[1]b$res[2]c$res[3]
? 当然有更好的做法这种做法了解即可。转载于:https://www.cnblogs.com/Answer1215/archive/2013/06/03/3114613.html