我在传递参数的时候如 ID_1.HTML 页面内容会显示出来!但是页面会乱掉!
但是我修改为ID=1的时候页面就会正常显示1
想问下怎么解决好呢

解决方案 »

  1.   

    function ParseUrl(){
      if($_SERVER['PATH_INFO']!=""){
      $pathinfo=substr($_SERVER['PATH_INFO'],1);
      $pathinfo=str_replace(".htm","",$pathinfo);
      $path=explode("_",$pathinfo);
       $count=count($path);
       for($i=0;$i<$count;$i+=2){
          $_GET[$path[$i]]=$path[$i+1];
        }
                     }
             }
     ParseUrl();
    $id = $_GET['id'];
    $sql="select * from xmnews where id=$id";
    $query=$db->query($sql);
    $rs=$db->fetch_array($query);$n=array("title"=>"$rs[title]","content"=>"$rs[content]");
    $smarty->assign("n",$n);
    $smarty->display("lxsinge.html",$id);
    {include file="sheader.html" }
    <div style="width:960px; margin:10px auto;">
    {include file="slefter.html" }
      <div style="width:725px; float:right;">
        <div style="width:725px; height:28px; background:url(images/tit.jpg);">
          <div style="padding:8px 0px 0px 18px; font-size:14px; font-weight:bold; color:#0C6190;"></div>
        </div>
        <div style="width:683px; min-height:400px; border-left:1px #E3EEF2 solid; border-right:1px #E3EEF2 solid; border-bottom:1px #E3EEF2 solid; padding:20px; line-height:175%; overflow-x:hidden;">     <div style="width:600px; margin:10px auto 20px auto; padding-bottom:10px; font-size:20px; color:#000000; font-family:黑体; text-align:center; border-bottom:1px #dddddd solid;">{$n.title}</div>
     
    {$n.content}
        </div>
      </div>
      
      
      <div style="clear:both;"></div>
     
    </div>
    {include file="footer.html" }
      

  2.   

    $i = 1;
    $loops = array();
    while($rs = $db->fetch_array($query)) {
    $crs = array();

    $crs['i'] = $i++;
    $crs['id'] = $rs['id'];
    $crs['title'] = $rs['title'];
    $crs['date'] =$rs['date'];

    $loops[] = $crs;
    }
    $db->free_result($query);$pagelist = $page->getpagelist();foreach($loops as $news) {
    $path="http://127.0.0.1/test2/singe.php/";
    $path.= MakeUrl(array('id'=>$news[id]));
    $arr2[]=array("ym"=>"$path","title"=>"$news[title]","date"=>"$news[date]");
    }//$arr=array("测试","内容");
    $smarty->assign("bb",$arr);
    $smarty->assign("c",$arr2);
    $smarty->assign("pagelist",$pagelist);
    $smarty->display("index.html",$pageno);
    //$smarty->clear_cache("index.html");