就像我的日志中的地址路径一样,让 index.php?action=one&do=two
变成: ?index/action/one/do/two
index.php <BR>-------------- <BR><?php <br><br>// PARSING QUERY STRING <BR>$QS=explode("&",$_SERVER['QUERY_STRING']); <BR>$QS=explode('/',$QS[0]); <br><br>// IF Modul is Undefined set it to index <BR>if (!$QS[0]) $MODUL='index'; <BR>else $MODUL=strtolower($QS[0]); <br><br>// WE can make a Variable $_QUERY <BR>// for alternative _GET <BR>for ($i=1;$i<count($QS);$i+=2) <BR>{ <BR>$_QUERY[$NVAR]=$NVAR=$QS[$i]; <BR>$$NVAR=$QS[$i+1]; <BR>} <br><br>// Check the Modul is exists? <BR>if (!file_exists("modul_directory/{ $MODUL }.php")) <BR>$MODUL="index"; <br><br>#### THIS IS EXAMPLE TO IMPLEMENTATION THE SCRIPT <BR>// Load The Template <BR>include("template.php"); <BR>// Load The Module <BR>include("modul_directory/{ $MODUL }.php"); <BR>// Load The Footer <BR>include("footer.php"); <br><br>?> <br><br>we can access the modu<span>!本文来源gaodai#ma#com搞*!代#%^码网5</span><pre>搞gaodaima代码
l in URL like this:
=================================
http://www.example.com/?forum/topic/20
– it mean load the modul forum.php, and set the _QUERY[‘topic’]=20
http://www.foo.com/?voting/id/54/type/piechart&choice=2
– it mean load the modul voting.php, and set the _QUERY[‘id’]=54 and _QUERY[‘type’]=’piechart’ and set _GET[‘choice’]=2