问题一:<a href="http://www.baidu.com/thread?tid=15vq5v3qgh6">XXX</a>      //页面有很多的这样的链接,就tid后面不一样
如何用str_replace()把它变成:
<a href="http://localhost/thread/15vq5v3qgh6.html">XXX</a>  //我其实是不会怎么在后面添加.html问题二:点链接后<a href="http://localhost/thread/15vq5v3qgh6.html">XXX</a>     //URL里只要有thread的,都交给thread.php来处理,怎样才能提交到thread.php

解决方案 »

  1.   

    伪静态,重定向.htaccess
    rewriteengine on 
    rewritebase /RewriteRule ^thread/(.+).html$ thread.php?tid=$1
      

  2.   

    5楼的对,重定向
    RewriteRule ^thread/(.*).html$ thread.php?tid=$1
      

  3.   

    问题一:<a href="http://www.baidu.com/thread?tid=15vq5v3qgh6">XXX</a> //页面有很多的这样的链接,就tid后面不一样
    如何用str_replace()把它变成:
    <a href="http://localhost/thread/15vq5v3qgh6.html">XXX</a> //我其实是不会怎么在后面添加.htm你str_replace 这个会吧?简单点$a=str_replace();
    $a=$a.'htm';
    <a href="<?php echo $a; ?>">xxx</a>
    不就解决了?