【发布时间】:2011-10-23 20:11:27
【问题描述】:
目前我正在这样做:
$lines = file('data/index');
foreach ($lines as $value)
list($title, $location) = explode("|", $value);
echo '<div id="entry"><a href="'.$location.'">'.$title.'</a></div>';
而data/index的内容是:
This is a test post|http://google.com
Another test post|http://google.com
但是,它只打印出该文件的最后一行。几乎就像每个“回声”都被一个新的覆盖。我显然没有正确地做到这一点。为什么它不工作,我怎样才能让它按照我想要的方式运行?
【问题讨论】:
-
让我猜猜,你是python背景的?
-
@code_burgar 在这种情况下,他的缩进是正确的;)