我有一個文本文件,它看起來像以下:如何從具有標題或元標記的文本文件回顯行?
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()
和fgets()
來讀取每一行並對其進行回顯。問題是<title>
和<meta />
未被回顯;線條返回空白。我怎樣才能讓php看到這些純文本並回顯它們?
編輯:下面是我使用的代碼:
$handle = fopen($myFile, 'r');
while(!feof($handle)){
$data = fgets($handle);
echo $data;
什麼是代碼? – 2013-02-24 09:21:19
向問題添加了代碼,謝謝。 – Phil 2013-02-24 09:24:39
該代碼應該可以正常工作。您是否使用瀏覽器進行檢查? – 2013-02-24 09:25:23