-5

// 悪い投票をしないでください // // この問題についてあなたの助けが必要です //

TXT データ: http://www.dhmi.gov.tr/UcusBilgileri/2/domarr.txt

自分のウェブサイトで定期的に所有するにはどうすればよいですか?

詳細: http://i.stack.imgur.com/Vb05A.png

注:下手な英語で申し訳ありません

4

1 に答える 1

1

テキスト ファイルを読み取り、値をテーブルの列に分割する場合は、次のようにします。

<?php
$handle = @fopen("domarr.txt", "r");

while (!feof($handle))
{
    $buffer = fgets($handle, 4096);

    if (strlen(trim($buffer)) > 0){

            list($a,$b,$c,$d,$e,$f,$g,$h,$i,$j)=explode(",",$buffer);

            $items[] = array('col1' => $a,'col2' => $b,'col3' => $c,'col4' => $d,'col5' => $e,'col6' => $f,'col7' => $g,'col8' => $h,'col9' => $i,'col10' => $j);

    }
}
?>

<table>
  <thead>
    <tr>
      <th>Col 1</th>
      <th>Col 2</th>
      <th>Col 3</th>
      <th>Col 4</th>
      <th>Col 5</th>
      <th>Col 6</th>
      <th>Col 7</th>
      <th>Col 8</th>
      <th>Col 9</th>
      <th>Col 10</th>
    </tr>
  </thead>
  <tbody>
    <?php foreach($items as $value) { ?>
    <tr>
      <td><?= $value['col1'] ?></td>
      <td><?= $value['col2'] ?></td>
      <td><?= $value['col3'] ?></td>
      <td><?= $value['col4'] ?></td>
      <td><?= $value['col5'] ?></td>
      <td><?= $value['col6'] ?></td>
      <td><?= $value['col7'] ?></td>
      <td><?= $value['col8'] ?></td>
      <td><?= $value['col9'] ?></td>
      <td><?= $value['col10'] ?></td>
    </tr>
    <?php } ?>
  </tbody>
</table>
于 2013-07-17T09:49:17.357 に答える