时间:2021-07-01 10:21:17 帮助过:2人阅读
101010100=北京 101010200=海淀 101010300=朝阳 101010400=顺义 101010500=怀柔 101010600=通州 101010700=昌平 101010800=延庆 101010900=丰台 101011000=石景山 101011100=大兴 101011200=房山 101011300=密云 101011400=门头沟 101011500=平谷 101011600=八达岭
$city=$_REQUEST["city"]; $city=iconv("utf-8","gb2312",$city); if ($city) { $fp=fopen("data.txt","r"); while (!feof($fp)) { $buffer = fgets($fp); list($code,$area)=explode("=",$buffer); if (trim($area)==$city) { echo $code; } } fclose($fp); } ?>
------解决方案--------------------