不知道为什么我的即时通讯页面出现空白? .txt 中有数据,php 中没有错误?
<?php
$fp = fopen("products.txt", "r");
flock($fp, LOCK_SH);
$headings = fgetcsv($fp, 0, "\t");
while ($aLineOfCells = fgetcsv($fp, 0, "\t")) {
$records[] = $aLineOfCells;
}
flock($fp, LOCK_UN);
fclose($fp);
echo $aLineOfCells;
?>
这是.txt
Product.txt
ID OID Title Description Option Price
01 01JAP Japanese Model This is the japanese option Japanese $3000
02 02ENG English Model This is the english option English $3000
每次你都会回显最后一行。
而每一个$aLineOfCells都是一个数组,需要将其取出来。
<?php
$fp = fopen("products.txt", "r");
flock($fp, LOCK_SH);
$headings = fgetcsv($fp, 0, "\t");
$aline = '';
while ($aLineOfCells = fgetcsv($fp, 0, "\t")) {
$records[] = $aLineOfCells[0];
$aline = $aline . $aLineOfCells[0] . "\n";
}
flock($fp, LOCK_UN);
fclose($fp);
echo $aline;
?>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)