就像我的日志中的地址路径一样,让 index.php?action=one&do=two
变成: ?index/action/one/do/two
index.php
--------------
<?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<count($qs);$i+=2)
{
$_query[$nvar]=$nvar=$qs[$i];
$$nvar=$qs[$i+1];
}
// check the modul is exists?
if (!file_exists("modul_directory/{ $modul }.php"))
$modul="index";
#### this is 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
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
网安追踪流程
1.不用代理网民发帖流程:发帖人 → ISP → 服务器托管商 → 服务器网警追踪流程:网监 → 服务器IP →...
[阅读全文]
-
-
-
HTTP状态码大全
转自:https://www.cnblogs.com/lxinxuan/archive/2009/10/22/1...
[阅读全文]
-
-
-
-
-
网友评论