返回列表 上一主題 發帖

[發問] exel資料庫作帳號密碼登錄

傳值 取值 與 判別

以下是引用憂藍夢境的BLOG 取excel的值

<?php
set_include_path(get_include_path() . PATH_SEPARATOR . './Classes/');
include 'PHPExcel/IOFactory.php';

$reader = PHPExcel_IOFactory::createReader('Excel5'); // 讀取舊版 excel 檔案
$PHPExcel = $reader->load("course_table.xls"); // 檔案名稱
$sheet = $PHPExcel->getSheet(0); // 讀取第一個工作表(編號從 0 開始)
$highestRow = $sheet->getHighestRow(); // 取得總列數

// 一次讀取一列
for ($row = 2; $row <= $highestRow; $row++) {

    for ($column = 1; $column <= 9; $column++) {
        $val = $sheet->getCellByColumnAndRow($column, $row)->getValue();
        echo $val . ' ';
    }
    echo "<br />";

}

TOP

        靜思自在 : 愛不是要求對方,而是要由自身的付出。
返回列表 上一主題