// PARSING QUERY STRING $QS=explode("&",$_SERVER['QUERY_S " /> 久热国产精品视频,亚洲深夜福利,日韩精品资源二区在线

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

php下實(shí)現(xiàn)偽 url 的超簡(jiǎn)單方法[轉(zhuǎn)]

就像我的日志中的地址路徑一樣,讓 index.php?action=one&do=two 
變成: ?index/action/one/do/two
復(fù)制代碼 代碼如下:
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 

php技術(shù)php下實(shí)現(xiàn)偽 url 的超簡(jiǎn)單方法[轉(zhuǎn)],轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 吉隆县| 洮南市| 额尔古纳市| 景德镇市| 仙桃市| 二连浩特市| 辽中县| 临清市| 固镇县| 西吉县| 望谟县| 老河口市| 贵港市| 大关县| 互助| 昌平区| 沧州市| 德惠市| 北票市| 青铜峡市| 仙桃市| 施秉县| 花垣县| 克山县| 云南省| 江陵县| 乐东| 东辽县| 德兴市| 澄迈县| 琼海市| 绵竹市| 宣威市| 丰城市| 确山县| 金华市| 大方县| 方城县| 保亭| 祁门县| 和静县|