Just like the address path in my log, let Index.php?action=one&do=two
Become:? index/action/one/do/two
Copy CodeThe code is as follows:
index.php
--------------
Parsing QUERY STRING
$QS =explode ("&", $_server[' query_string ']);
$QS =explode ('/', $QS [0]);
IF Modul is Undefined set it to index
if (! $QS [0]) $MODUL = ' index ';
else $MODUL =strtolower ($QS [0]);
WE can make a Variable $_query
For alternative _get
for ($i =1; $i {
$_query[$NVAR]= $NVAR = $QS [$i];
$ $NVAR = $QS [$i +1];
}
Check The Modul is exists?
if (!file_exists ("modul_directory/{$MODUL}.php"))
$MODUL = "index";
# # # # # # # # # EXAMPLE to implementation the SCRIPT
Load the Template
Include ("template.php");
Load the Module
Include ("modul_directory/{$MODUL}.php");
Load the Footer
Include ("footer.php");
?>
We can access the Modul in URL like this:
=================================
Www.example.com/?forum/topic/20
-it mean load the Modul forum.php, and set the _query[' topic ']=20
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
http://www.bkjia.com/PHPjc/318416.html www.bkjia.com true http://www.bkjia.com/PHPjc/318416.html techarticle just like the address path in my log, let index.php?action=onenbsp; index/action/one/do/two copy the Code code as follows: index.php--------------? PHP// Parsingquerystring ...