到目前为止,我有下面的代码,但结果,唯一显示的是页面标题。我正在尝试将下面的文本文件读入数组:
pear|apple|strawberry|lime|elderberry|watermelon|orange|banana|fig|mango|plum
在网页上显示此文本时,我需要爆炸“|” 分隔符并在垂直列表中显示水果。有什么帮助吗?这是我在正文中的代码:
<h1>Sorted Fruits</h1>
<?php
$file = "Exercise5/exercise5.txt";
$FruitList = file($file);
$lines = explode("| ", $c);
foreach ( $lines as $l ) {
echo $l;
die();
}
?>