html text标签 如何在网页中读取text文件?

如何在网页中读取text文件?方法很简单,用fopen,加扩展,为实现。*/$文件=“/”文本.txt“$text=free(fopen($file,”R“),filesize($file))$lin

如何在网页中读取text文件?

方法很简单,用fopen,加扩展,为实现。

*/$文件=“/”文本.txt“

$text=free(fopen($file,”R“),filesize($file))

$line=expand(”R“,$text)

echo”

($I=0$I<=count($line)$I){

$TXT=expand(”t“,$line[$I])

echo”

]}

echo”。$TXT[0]。 ". $TXT[1]。". ". $TXT[2]。". $TXT[3

//方法2

$content=filegetcontents()测试.txt“)

$arr=explode(”n“,$content)

echo””foreach($v arr){

$tmp=explode(”“,$v)

echo”“

echo”“

echo”“

echo”“

echo”“

echo”“

unset($tmp)

}echo“

”。$tmp[0]。"" . $tmp[1]。"" . $tmp[2]。"" . $tmp[3]。“”]//实际上,没有办法实现file函数,我就不多说了。检查看,它把读取的内容直接保存到数据中,不需要使用扩展功能。

/*

文本格式如下:按如下方式读取文本文件

1 AAAA bbba CCCA

2 AAAA BBBB CCCB

3 AAAA BBBC CCCC

3 AAAA BBBC CCCC