原文:http://zhidao.baidu.com/question/91866270.html
已知txt数据格式:
1 农贸城 11-7-7-16
2 幸福居委会 11
3 城西医院 11
4 凯吉路 11
5 仪表有限公司 11
$filename='a.txt';//文件名
$str=file_get_content($filename);//获得内容
$arr=explode("\n",$str);//分行存入数组
foreach($arr as $row){//遍历每行
$temp=explode(" ",$row);
//此时$temp[0]=前面的id号,$temp[1]=中文名,$temp[2]=后面的一长串
//赋值吧
}
//explode是按字符分割string
//可以查查php手册
//存回去用file_put_content