请问PHP读取txt有关问题,UNICODE编码的

WBOY
Release: 2016-06-13 13:46:00
Original
897 people have browsed it

请教PHP读取txt问题,UNICODE编码的
a.txt内容如下
1 张三 19731114
2 李四 19671029

字段长分别是5位,10位,8位

取出时把前两位去掉了
$file_dir="a.txt"; //the open file
$fp=fopen($file_dir,"r"); 
$content1=fread($fp,filesize($file_dir));
$arr=array();
$bom=substr($content1,0,2);//去除文件头
$content=substr($content1,2);
$arr=$content;
$arr=explode("\n",$content);
在substr时发现为数得*2,才能取正确,现在麻烦的是中文取出来乱码,请教如何转换?

另外,要生成个新的txt文本,也要UNICODE的没办法?


------解决方案--------------------
发表于:2007-10-09 18:53:13

这样的帖子你们也回?
楼主早就都不知道到哪去了!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template