로 구분 된 파일로 채워집니다 테이블 : (샘플 레코드)만 마지막 튜플은 내가 HTML 테이블에 기록의 유형이 PHP
game191|06/09/2007|Jennifer Woods Memorial Grand Prix|C54|Nikolayev, Igor|2431|Parry, Matt|2252|1-0
나는이 시도하지만, 그것은 단지 데이터 파일 (/games.csv
)
<?php
// open delimited data file "|" if needed and read.
//game191|06/09/2007|Jennifer Woods Memorial Grand Prix|C54|Nikolayev, Igor|2431|Parry, Matt|2252|1-0
if(!isset($_SESSION['games_array'])) {$file = $_SERVER['DOCUMENT_ROOT'].'/games.csv';
$fp = fopen($file,"r"); $list = fread($fp, filesize($file));
$_SESSION['games_array'] = explode("\n",$list); fclose($fp);}
// extract variables from each tuple by iteration
foreach ($_SESSION['games_array'] as $v);{
$token = explode("|", $v);
//write the table row and table data
echo "<tr class=\"simplehighlight\" onclick=\"window.location.href='./games/";
echo $token[0]; echo ".php';\">";
echo "<td>";echo $token[1];echo "</td>"; echo "<td>";echo $token[2];echo "</td>";
echo "<td>";echo $token[3];echo "</td>"; echo "<td>";echo $token[4];echo "</td>";
echo "<td>";echo $token[5];echo "</td>"; echo "<td>";echo $token[6];echo "</td>";
echo "<td>";echo $token[7];echo "</td>";
echo "<td class=\"text-center\">"; echo $token[8];echo "</td>";
echo "</tr>";};
?>
,691에서 마지막 레코드를 표시
무엇이 누락 되었습니까?
$lines = file('filename');
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
내가 그 실수를 할 때마다 한푼도 썼다면 ... 음, 어쨌든 나는 몇 마디가 될 것이다. – AgentConundrum
날카로운 눈에 +1 +1 – devrooms