//二级域名泛解析后的处理
function domain(){
$domain = getcache('domain','commons');
$domain_data = $domain[$GLOBALS['domain']];
if( !empty($domain_data) ){
return parse_domain($domain_data) ;
}
else{
header("HTTP/1.1 404 Not Found");
header("Status: 404 Not Found");
$db = pc_base::load_model('http404_model');
$db->add();
echo file_get_contents(PHPCMS_PATH.'404.htm');
}
}</p>
<p>
function parse_domain($array){</p>
<p> switch($array['type']){
case '3833'://手术项目,也即栏目
$catid = $array['keyid'];
$id = $_GET['id'];
$GET = $id ? array('id'=>$id,'catid'=>$catid) : array('catid'=>$catid);
$newarr = array('m'=>'content','c'=>'index','a'=>$id ? 'show': 'lists','data'=>array('GET'=>$GET));
$GLOBALS['catid'] = $catid;
break;</p>
<p> case '3834'://城市地区
$newarr = array('m'=>'content','c'=>'city','a'=>'init','data'=>array('GET'=>array('areaid'=>$array['keyid'])));
$GLOBALS['cityid'] = $array['keyid'];
break;</p>
<p>
case '3835'://整形医院
$newarr = array('m'=>'yp','c'=>'com_index','a'=>'init','data'=>array('GET'=>array('userid'=>$array['keyid'])));
$GLOBALS['hospitalid'] = $array['keyid'];
break;
}
return $newarr;</p>
<p> }
结合了联动菜单的地区,权当是抛砖引玉了.
尤其注意
$newarr = array('m'=>'content','c'=>'city','a'=>'init','data'=>array('GET'=>array('areaid'=>$array['keyid'])));
这里的定义方式,数据的格式一定要正确.