我有一个如下所示的文本文件:
http://tisue.net/jandek/live.html
<title>Jandek: Live</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
http://news.nationalgeographic.com/news/2004/06/0629_040629_camelspider.html
<title>Camel Spiders: Behind an E-Mail Sensation From Iraq</title>
<meta name="description" content="A photo of a U.S. soldier in Iraq holding massive, hairy, supposedly flesh-eating spiders has been burning up e-mail in-boxes around the world. The arachnids (called camel spiders or wind scorpions) are real, but scientists say many claims about them are anything but.">
还有几千个这样的。
我正在使用fopen()
andfgets()
来读取每一行并回显它。问题是<title>
and<meta />
没有被回显;行返回空白。我怎样才能让 php 将它们视为纯文本并回显它们?
编辑:这是我正在使用的代码:
$handle = fopen($myFile, 'r');
while(!feof($handle)){
$data = fgets($handle);
echo $data;