www.gusucode.com > Destoon B2B仿淘宝电子商务网站 UTF8 v6.0源码程序 > destoon/include/rewrite.inc.php

    <?php
/*
	[Destoon B2B System] Copyright (c) 2008-2015 www.destoon.com
	This is NOT a freeware, use is subject to license.txt
*/
defined('IN_DESTOON') or exit('Access Denied');
$pstr = '';
if(isset($_SERVER['UNENCODED_URL']) && $_SERVER['UNENCODED_URL']) {//IIS7
	$_SERVER['QUERY_STRING'] = basename($_SERVER['UNENCODED_URL']);
	if(strpos($_SERVER['QUERY_STRING'], '-htm-') !== false) {
		$tmp = explode('-htm-', $_SERVER['QUERY_STRING']);
		$_SERVER['QUERY_STRING'] = $tmp[1];
	}
}
if($_SERVER['QUERY_STRING']) {
	if(preg_match("/^(.*)\.html$/", $_SERVER['QUERY_STRING'], $_match)) {
		$pstr = $_match[1];
	} else if(preg_match("/^(.*)\/$/", $_SERVER['QUERY_STRING'], $_match)) {
		$pstr = $_match[1];
	}
} else if($_SERVER["REQUEST_URI"] != $_SERVER["SCRIPT_NAME"]) {
	$string = str_replace($_SERVER["SCRIPT_NAME"], '', $_SERVER["REQUEST_URI"]);
	if($string && preg_match("/^\/(.*)\/$/", $string, $_match)) $pstr = $_match[1];
}
if($pstr && strpos($pstr, '-') !== false) {
	$pstr = explode('-', $pstr);
	$pstr_count = count($pstr);
	if($pstr_count%2 == 1) --$pstr_count;
	for($i = 0; $i < $pstr_count; $i++) { $_GET[$pstr[$i]] = $MQG ? addslashes($pstr[++$i]) : $pstr[++$i]; }
}
?>