常德php
㈠ php 根據城市名找到省份名稱的方法
採集遇到沒有省份只有城市問題;
採用城市名找到省份名稱的方法:
$allcitys = array(
array("北京"),
array("上海"),
array("天津"),
array("重慶"),
array("哈爾濱", "齊齊哈爾", "牡丹江", "大慶", "伊春", "雙鴨山", "鶴崗", "雞西", "佳木斯", "七台河", "黑河", "綏化", "大興安嶺"),
array("長春", "延邊", "吉林", "白山", "白城", "四平", "松原", "遼源", "大安", "通化"),
array("沈陽", "大連", "葫蘆島", "旅順", "本溪", "撫順", "鐵嶺", "遼陽", "營口", "阜新", "朝陽", "錦州", "丹東", "鞍山"),
array("呼和浩特", "呼倫貝爾", "錫林浩特", "包頭", "赤峰", "海拉爾", "烏海", "鄂爾多斯", "通遼"),
array("石家莊", "唐山", "張家口", "廊坊", "邢台", "邯鄲", "滄州", "衡水", "承德", "保定", "秦皇島"),
array("鄭州", "開封", "洛陽", "平頂山", "焦作", "鶴壁", "新鄉", "安陽", "濮陽", "許昌", "漯河", "三門峽", "南陽", "商丘", "信陽", "周口", "駐馬店"),
array("濟南", "青島", "淄博", "威海", "曲阜", "臨沂", "煙台", "棗庄", "聊城", "濟寧", "菏澤", "泰安", "日照", "東營", "德州", "濱州", "萊蕪", "濰坊"),
array("太原", "陽泉", "晉城", "晉中", "臨汾", "運城", "長治", "朔州", "忻州", "大同", "呂梁"),
array("南京", "蘇州", "崑山", "南通", "太倉", "吳縣", "徐州", "宜興", "鎮江", "淮安", "常熟", "鹽城", "泰州", "無錫", "連雲港", "揚州", "常州", "宿遷"),
array("合肥", "巢湖", "蚌埠", "安慶", "六安", "滁州", "馬鞍山", "阜陽", "宣城", "銅陵", "淮北", "蕪湖", "毫州", "宿州", "淮南", "池州"),
array("西安", "韓城", "安康", "漢中", "寶雞", "咸陽", "榆林", "渭南", "商洛", "銅川", "延安"),
array("銀川", "固原", "中衛", "石嘴山", "吳忠"),
array("蘭州", "白銀", "慶陽", "酒泉", "天水", "武威", "張掖", "甘南", "臨夏", "平涼", "定西", "金昌"),
array("西寧", "海北", "海西", "黃南", "果洛", "玉樹", "海東", "海南"),
array("武漢", "宜昌", "黃岡", "恩施", "荊州", "神農架", "十堰", "咸寧", "襄樊", "孝感", "隨州", "黃石", "荊門", "鄂州"),
array("長沙", "邵陽", "常德", "郴州", "吉首", "株洲", "婁底", "湘潭", "益陽", "永州", "岳陽", "衡陽", "懷化", "韶山", "張家界"),
array("杭州", "湖州", "金華", "寧波", "麗水", "紹興", "雁盪山", "衢州", "嘉興", "台州", "舟山", "溫州"),
array("南昌", "萍鄉", "九江", "上饒", "撫州", "吉安", "鷹潭", "宜春", "新余", "景德鎮", "贛州"),
array("福州", "廈門", "龍岩", "南平", "寧德", "莆田", "泉州", "三明", "漳州"),
array("貴陽", "安順", "赤水", "遵義", "銅仁", "六盤水", "畢節", "凱里", "都勻"),
array("成都", "瀘州", "內江", "涼山", "阿壩", "巴中", "廣元", "樂山", "綿陽", "德陽", "攀枝花", "雅安", "宜賓", "自貢", "甘孜州", "達州", "資陽", "廣安", "遂寧", "眉山", "南充"),
array("廣州", "深圳", "潮州", "韶關", "湛江", "惠州", "清遠", "東莞", "江門", "茂名", "肇慶", "汕尾", "河源", "揭陽", "梅州", "中山", "德慶", "陽江", "雲浮", "珠海", "汕頭", "佛山"),
array("南寧", "桂林", "陽朔", "柳州", "梧州", "玉林", "桂平", "賀州", "欽州", "貴港", "防城港", "百色", "北海", "河池", "來賓", "崇左"),
array("昆明", "保山", "楚雄", "德宏", "紅河", "臨滄", "怒江", "曲靖", "思茅", "文山", "玉溪", "昭通", "麗江", "大理"),
array("海口", "三亞", "儋州", "瓊山", "通什", "文昌"),
array("烏魯木齊", "阿勒泰", "阿克蘇", "昌吉", "哈密", "和田", "喀什", "克拉瑪依", "石河子", "塔城", "庫爾勒", "吐魯番", "伊寧"),
array("拉薩","昌都地區","山南地區","阿里地區","那曲地區","林芝地區","日喀則地區"),
array("香港"),
array("澳門"),
array("台灣"),
);
$pro[0]="北京";
$pro[1]="上海";
$pro[2]="天津";
$pro[3]="重慶";
$pro[4]="黑龍江";
$pro[5]="吉林";
$pro[6]="遼寧";
$pro[7]="內蒙古";
$pro[8]="河北";
$pro[9]="河南";
$pro[10]="山東";
$pro[11]="山西";
$pro[12]="江蘇";
$pro[13]="安徽";
$pro[14]="陝西";
$pro[15]="寧夏";
$pro[16]="甘肅";
$pro[17]="青海";
$pro[18]="湖北";
$pro[19]="湖南";
$pro[20]="浙江";
$pro[21]="江西";
$pro[22]="福建";
$pro[23]="貴州";
$pro[24]="四川";
$pro[25]="廣東";
$pro[26]="廣西";
$pro[27]="雲南";
$pro[28]="海南";
$pro[29]="新疆";
$pro[30]="西藏";
$pro[31]="香港";
$pro[32]="澳門";
$pro[33]="台灣";
for ($i = 0; $i < count($allcitys); $i++)
{
for ($j = 0;$j < count($allcitys[$i]); $j++)
{
if ($allcitys[$i][$j] == $area)
{
$currpro = $pro[$i];
}
}
}
㈡ 請問如何實現:在網頁中選擇了國家,下面自動出現該國家的省名供選擇
<script type="text/javascript">
//定義了城市的二維數組,裡面的順序跟省份的順序是相同的。通過selectedIndex獲得省份的下標值來得到相應的城市數組
var city=[
["北京","天津","上海","重慶","香港","澳門"],
["石家莊","唐山","秦皇島","邯鄲","邢台","保定","張家口","承德","滄州","廊坊","衡水"],
["太原","大同","陽泉","長治","晉城","朔州","晉中","運城","忻州","臨汾","呂梁"],
["呼和浩特","包頭","烏海","赤峰","通遼","鄂爾多斯","呼倫貝爾","巴彥淖爾","烏蘭察布","興安","錫林郭勒","阿拉善"],
["沈陽","大連","鞍山","撫順","本溪","丹東","錦州","營口","阜新","遼陽","盤錦","鐵嶺","朝陽","葫蘆島"],
["長春","吉林","四平","遼源","通化","白山","松原","白城","延邊"],
["哈爾濱","齊齊哈爾","雞西","鶴崗","雙鴨山","大慶","伊春","佳木斯","七台河","牡丹江","黑河","綏化","大興安嶺"],
["南京","蘇州","揚州","無錫","徐州","常州","南通","連雲港","淮安","鹽城","鎮江","泰州","宿遷"],
["杭州","寧波","溫州","嘉興","湖州","紹興","金華","衢州","舟山","台州","麗水"],
["合肥","蕪湖","蚌埠","淮南","馬鞍山","淮北","銅陵","安慶","黃山","滁州","阜陽","宿州","巢湖","六安","亳州","池州","宣城"],
["福州","寧德","南平","廈門","莆田","三明","泉州","漳州"],
["南昌","上饒","萍鄉","九江","景德鎮","新余","鷹潭","贛州","吉安","宜春","撫州"],
["濟南","青島","淄博","棗庄","東營","煙台","濰坊","威海","濟寧","泰安","日照","萊蕪","臨沂","德州","聊城","濱州","菏澤"],
["鄭州","開封","洛陽","平頂山","焦作","鶴壁","新鄉","安陽","濮陽","漯河","許昌","三門峽","南陽","商丘","信陽","周口","駐馬店"],
["武漢","十堰","襄樊","鄂州","黃石","荊州","宜昌","荊門","孝感","黃岡","咸寧","隨州","恩施"],
["長沙","株洲","湘潭","岳陽","邵陽","常德","衡陽","張家界","益陽","郴州","永州","懷化","婁底","湘西"],
["廣州","清遠","潮州","東莞","珠海","深圳","汕頭","韶關","佛山","江門","湛江","茂名","肇慶","惠州","梅州","汕尾","陽江","河源","中山","揭陽","雲浮"],
["南寧","柳州","桂林","梧州","北海","防城港","欽州","貴港","玉林","百色","賀州","河池","來賓","崇左"],
["海口","三亞"],
["成都","自貢","攀枝花","瀘州","德陽","綿陽","廣元","遂寧","內江","樂山","南充","宜賓","廣安","達州","眉山","雅安","巴中","資陽","阿壩","甘孜","涼山"],
["貴陽","六盤水","遵義","安順","銅仁","畢節","黔西南","黔東南","黔南"],
["昆明","曲靖","玉溪","保山","昭通","麗江","普洱","臨滄","文山","紅河","西雙版納","楚雄","大理","德宏","怒江","迪慶"],
["拉薩","昌都","山南","日喀則","那曲","阿里","林芝"],
["西安","銅川","寶雞","咸陽","渭南","延安","漢中","榆林","安康","商洛"],
["蘭州","白銀","定西","敦煌","嘉峪關","金昌","天水","武威","張掖","平涼","酒泉","慶陽","臨夏","隴南","甘南"],
["西寧","海東","海北","黃南","海南","果洛","玉樹","海西"],
["銀川","石嘴山","吳忠","固原","中衛"],
["烏魯木齊","克拉瑪依","吐魯番","哈密","和田","阿克蘇","喀什","克孜勒蘇柯爾克孜","巴音郭楞蒙古","昌吉","博爾塔拉蒙古","伊犁哈薩克","阿勒泰"],
["台北","高雄","基隆","台中","台南","新竹","嘉義"]
];
function getCity(){
//獲得省份下拉框的對象
var sltProvince=document.forms[0].province;
//獲得城市下拉框的對象
var sltCity=document.forms[0].city;
//得到對應省份的城市數組
var provinceCity=city[sltProvince.selectedIndex - 1];
//清空城市下拉框,僅留提示選項
sltCity.length=1;
//將城市數組中的值填充到城市下拉框中
for(var i=0;i<provinceCity.length;i++){
sltCity[i+1]=new Option(provinceCity[i],provinceCity[i]);
}
}
</script>
<form action="#" method="POST" name="myform" target="_self" id="myform">
<select name="province" onChange="getCity()">
<option value="null" disabled="disabled">請選擇所在省份</option>
<option value="直轄市">直轄市</option>
<option value="河北">河北</option>
<option value="山西">山西</option>
<option value="內蒙古">內蒙古</option>
<option value="遼寧">遼寧</option>
<option value="吉林">吉林</option>
<option value="黑龍江">黑龍江</option>
<option value="江蘇">江蘇</option>
<option value="浙江">浙江</option>
<option value="安徽">安徽 </option>
<option value="福建">福建 </option>
<option value="江西">江西</option>
<option value="山東">山東</option>
<option value="河南">河南</option>
<option value="湖北">湖北</option>
<option value="湖南">湖南</option>
<option value="廣東">廣東</option>
<option value="廣西">廣西</option>
<option value="海南">海南</option>
<option value="四川">四川</option>
<option value="貴州">貴州</option>
<option value="雲南">雲南</option>
<option value="西藏">西藏</option>
<option value="陝西">陝西 </option>
<option value="甘肅">甘肅 </option>
<option value="青海">青海</option>
<option value="寧夏">寧夏</option>
<option value="新疆">新疆</option>
<option value="台灣">台灣</option>
</select>
<select name="city">
<option selected="selected" value="null">請選擇所在城市</option>
</select>
</form> 直接用就可以了。這是 省市 2級聯動
㈢ 如何實現不同地區的ip訪問同一個網站顯示不同頁面的內容啊,本人php基礎性太差
你的問題首先你要先知道不同區域的ip地址劃分區間,然後獲取客戶端的ip地址,再判斷是哪個地址的ip地址,最後用js做域名跳轉。
比如:先獲取湖北的ip地址范圍
061.136.201.000 061.136.202.255 湖北省 武漢市
061.183.000.000 061.183.003.255 湖北省 武漢市
然後php就寫獲取客戶端的ip
$ip=getenv("REMOTE_ADDR");//獲取ip地址
if($ip=="061.136.201.000"){
echo"<script>location.href=123..com;</script>";
}else{
echo"<script>location.href=234..com;</script>";}
㈣ 常德定做衣櫃的時候注意這些才不會選錯
定製衣櫃是最近流行的傢具。根據傢具行業的調查,衣櫃是家庭生活中常見的傢具。這也是一個文本衣櫃與沖貢多夫。但大多數人都會選擇在常德定做衣櫃。但是,有些問題被忽略了。定製的衣櫃與幾乎傳統的衣櫃是分開的。它是消費者的主要選擇。
目前,市場上用於定做衣櫃的主要材料是刨花板、中纖維板、實木板。雖然粒狀板具有很好的抗濕性,但不容易成為塑料。中纖維板作為歐美市場最常見的板材,具有很強的承載和壓縮耐久性。實木傢具採用純天然木材,但在乾燥潮濕的環境中容易破碎。常德定做衣櫃的問題與環境保護直接相關。定製的衣櫃主板是實木和普通木。實木板是以環保為基礎的。底座為實木和綠色。因此,成本相對較高。然而,目前日本的實木技術還不夠成熟。因此,應慎重選擇實木的質量。
由於常德定做衣櫃最大的好處是可以根據需求來設計的,在款式上,我們需要保持整體空間和房間的調整,原創的房間設計和色彩搭配影響衣櫃的設計,所以不要自作主張,否則設計的衣櫃會爆發整體空間的調整,會突然出現。
衣櫃的一般使用壽命取決於五金配件。好的配飾可以擴大衣櫃的面積。在選擇配件時,既要注意價格,又要注意性能價格比。選擇一個好的五金配件將在常德定做衣櫃時省去很多麻煩,你不必花更多不公平的錢,尤其是衣櫃掛鉤,幻燈片,架子和其他配件。同時選擇最好的質量。
常德定做衣櫃中的五金配件主要用於滑輪、導軌、門鉸鏈、把手、三個單接頭,滑輪主要用於滑動門,包括門導軌和抽屜導軌。門鉸鏈主要用於衣櫃的門上。把手包括門板把手和抽屜把手。這兩個儀器是用來連接和固定整個衣櫃的。常德定做衣櫃硬體的主要區別在於它是否是品牌產品。定製內部模式不變,可根據消費者實際使用情況進行調整。定製衣櫃功能部件的功能體現在衣櫃的整體使用上,增加了方便性。
一般來說,常德定做衣櫃的功能部件包括衣架、衣架、衣物、抽屜和鏡子。這些功能組件的存在使得定製衣櫃的使用更加容易。功能部件的數量也會影響衣櫃的整體價格。消費者可以根據實際情況和個人喜好進行變化和平衡。
土巴兔在線免費為大家提供「各家裝修報價、1-4家本地裝修公司、3套裝修設計方案」,還有裝修避坑攻略!點擊此鏈接:【https://www.to8to.com/yezhu/zxbj-cszy.php?to8to_from=seo__m_jiare&wb】,就能免費領取哦~