最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時間:2007年09月24日 11:41:47   作者:  
就像我的日志中的地址路徑一樣,讓 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 

相關(guān)文章

最新評論

宁晋县| 巴塘县| 安康市| 柳州市| 安陆市| 河东区| 霍山县| 南通市| 巩义市| 凉山| 兴安盟| 昌乐县| 宾阳县| 渭南市| 郁南县| 吴忠市| 德惠市| 阳高县| 塔城市| 潞西市| 宾川县| 文登市| 德化县| 安多县| 富民县| 奉节县| 枣阳市| 无锡市| 潞西市| 汝阳县| 察哈| 方城县| 永善县| 筠连县| 鞍山市| 信宜市| 文水县| 济源市| 花莲市| 喀喇沁旗| 梁河县|