七彩课堂[网页设计知识系列]
二级域名分站的实现思路
目标:实现 shanghai.yourname.com ;beijign.yourname.com 此类二级站。
思路:根据二级域名前面的字母,来判断省市的名称。
代码:

<%
’取得HTTP输入的值并付值到host中
httptext=lcase(request.servervariables("HTTP_HOST"))
’分割以.
host=split(httptext,".")
’取出第一个.前的字符串
hosts=host(0)
’取得城市拼音
httptext=Replace(hosts,"http://","")
’地区拼音数组
citypy = array("shanghai","beijing","tianjin","chongqing","hebei","shanxi","neimenggu",
"liaoning","jilin","heilongjiang","jiangsu","zhejiang","anhui","fujian","jiangxi",
"shandong","henan","hubei","hunan","guangdong","guangxi","hainan",
"sichuan","guizhou","yunnan","xizang","shaanxi","gansu","ningxia","qinghai",
"xinjiang") ’地区汉字数组
pro=array("上海","北京","天津","重庆","河北","山西","内蒙古","辽宁","吉林","黑龙江",
"江苏","浙江","安徽","福建","江西","山东","河南","湖北","湖南","广东","广西","海南",
"四川","贵州","云南","西藏","陕西","甘肃","宁夏","青海","新疆")
’利用循环,找出当前的城市汉字名
For y=0 to Ubound(citypy)
If citypy(y)=httptext Then
’取得当前城市名
cityname=pro(y)
End If
Next
%>

 
信息推荐
资讯中心 | 电子商务 | 搜索营销 | 设计学院 | 中医养生 | 养生保健 | 节日祝福 | 民俗文化 | 奇闻趣事
建站知识 | 人世百态 | 网站导航 | 传统节日 | 搜索热点 | 星座运势 | 趣闻轶事 | 祝福的话 | 短信大全
© 2023 QicaiSpace.Com