Hướng dẫn class phpexcel_iofactory not found in codeigniter - lớp phpexcel_iofactory không tìm thấy trong codeigniter

Tôi đã làm theo hướng dẫn này ở đây

https://arjunphp.com/how-to-use-phpexcel-with-codeigniter/

và đây

http://www.ahowto.net/php/easily-integrateload-phpexcel-into-codeigniter-framework/

Tuy nhiên, tôi vẫn nhận được lỗi không tìm thấy PhpExcel_iofactory. Tôi đã không tìm thấy nhiều sự giúp đỡ trong lĩnh vực này. Có một plugin excel thay thế hoặc có cách nào để giải quyết vấn đề này không?

Đây là bộ điều khiển của tôi xây dựng

public function __construct() {        
        parent::__construct();
        $this->load->library('Excel');
    }

Đây là chức năng tải lên bộ điều khiển của tôi

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );

Tôi đang sử dụng Laravel 5.0 và mã này bên dưới trong bộ điều khiển của tôi hoạt động tốt trong quá trình sản xuất.

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`

Nhưng khi tôi tải lên nó trong Philwebhosting, tôi sẽ gặp lỗi này.

Tôi đã thử thêm mã này include_once('PHPExcel/PHPExcel.php'); nhưng vẫn nhận được lỗi tương tự. Làm thế nào tôi có thể giải quyết điều này?
How can i resolve this?

Cảm ơn bạn.

  • El ForumGuest
    Guest
  • & nbsp;


. Tôi đã tạo một thư mục PHPExcel trong thư mục thư viện, đặt thư mục phpExcel.php và phpExcel vào đó, sau đó sử dụng mã sau:
Hi,

Tôi đã phải thay đổi bao gồm_path vì nếu không, các tệp PHPExcel sẽ không tải đúng cách (khi PHPExcel cố gắng tự động tải một số tệp), nhưng sau đó tôi thay đổi lại, sau khi tôi hoàn thành với PHPExcel. Lưu ý rằng bạn có thể không cần Excel2007 hoặc Iofactory, tất cả phụ thuộc vào những thành phần của PHPEXCEL bạn đang sử dụng.

Hi vọng điêu nay co ich.

[Eluser] Bonk [/Eluser] Bruno,

Tôi đã thử hướng dẫn của bạn, nhưng nó vẫn bị mắc kẹt trong cùng một dòng. Khi nó được cho là tải phpexcel.php, chỉ có màn hình trống.

Vì vậy, tôi đã cố gắng tải điều này dưới dạng plugin, thư viện, lớp tùy chỉnh và bây giờ theo cách của bạn, do đó vấn đề phải ở nơi khác. Bạn có thể hoặc người khác xác nhận rằng bạn đã không chỉnh sửa các lớp PHPExcel nào không?

Tôi đang cố gắng tải PhpExcel với một trong những điều này:

Code:

$this->load->library("PHPExcel");

Code:

$this->load->plugin("phpexcel");

Phần còn lại của mã là bản sao chính xác từ các chủ đề ở trên. Kịch bản tiếp tục, nhưng dừng lại trên một trong hai điều này. Tôi không nhận được lỗi trên màn hình và nhật ký Apache cũng trống.

Bất kỳ ý tưởng gì tôi đang bỏ lỡ ở đây? Một cái gì đó liên quan đến cấu hình Apache của tôi? Cả hai chủ đề này đều hướng dẫn không thao túng PHPExcel, tôi có nên chỉnh sửa một cái gì đó trên các lớp học không?

Tôi sẽ rất biết ơn nếu ai đó chỉ cho tôi đúng hướng.

  • El ForumGuest
    Guest
  • & nbsp;


. Tôi đã tạo một thư mục PHPExcel trong thư mục thư viện, đặt thư mục phpExcel.php và phpExcel vào đó, sau đó sử dụng mã sau:
I don't know what's wrong, or what you tried to do, but personally, I used PHPExcel without loading it as a library. I created a PHPExcel folder in the libraries folder, put the PHPExcel.php and the PHPExcel folder in it, and then used the following code:

Code:

$oldIncludePath = get_include_path();
        set_include_path(APPPATH . 'libraries/PHPExcel');

        include_once 'PHPExcel.php';
        include_once 'PHPExcel/Writer/Excel2007.php';
        include_once 'PHPExcel/IOFactory.php';

        $objPHPExcel = new PHPExcel();

        # my code here, using phpexcel

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
0

Tôi đã phải thay đổi bao gồm_path vì nếu không, các tệp PHPExcel sẽ không tải đúng cách (khi PHPExcel cố gắng tự động tải một số tệp), nhưng sau đó tôi thay đổi lại, sau khi tôi hoàn thành với PHPExcel. Lưu ý rằng bạn có thể không cần Excel2007 hoặc Iofactory, tất cả phụ thuộc vào những thành phần của PHPEXCEL bạn đang sử dụng.

Hi vọng điêu nay co ich.

  • El ForumGuest
    Guest
  • & nbsp;


. Để sửa nó, chèn mã sau vào index.php của bạn, ngay trước khi nhận xét có "tải tệp bootstrap", như dưới đây:
Bruno,

Hãy cho tôi biết nếu điều đó làm cho các lỗi hiển thị.

Code:

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
1

[Eluser] Bonk [/Eluser] Cảm ơn Bruno!

Đây thực sự là bước đầu tiên để thực hiện công việc này.

1) Đã tải xuống và cài đặt CI 2.0 (Màn hình chào mừng OK) 2) Đã tải xuống PhpExcel 1.7.6 3) Đã tạo thư mục "PXL" vào thư viện (/application/thư viện/pxl) 4) PHPExcel-folder (/application/libries/pxl/phpexcel.php &/application/thư viện/pxl/phpexcel/) 5) Đã tạo thư mục pxl.php cho thư viện với dữ liệu này:
2) Downloaded PHPExcel 1.7.6
3) Created "pxl" folder to libraries (/application/libraries/pxl)
4) Copied PHPExcel classes to this folder, both PHPExcel.php and PHPExcel-folder (/application/libraries/pxl/PHPExcel.php & /application/libraries/pxl/PHPExcel/)
5) Created pxl.php to libraries folder with this data:

Code:

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
2

6) Đã thêm chức năng Excel1 để chào mừng.php Trình điều khiển

Code:

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
3

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
4

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
5

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
6

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
7

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
8

$objReader= PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true); 
$objPHPExcel= PHPExcel_IOFactory::load($document_folder."/".$file_name.".".$file_extension);    
//        $this->response($objPHPExcel);
$objPHPExcel=$objReader->load($document_folder."/".$file_name.".".$file_extension); 
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);  
for($i=2;$i<=$totalrows;$i++){ //2 is one row after the header rows
    $title= $objWorksheet->getCellByColumnAndRow(0,$i)->getValue();     
    $first_name= $objWorksheet->getCellByColumnAndRow(1,$i)->getValue();            
    $last_name= $objWorksheet->getCellByColumnAndRow(2,$i)->getValue(); 
    $date_of_birth= $objWorksheet->getCellByColumnAndRow(3,$i)->getValue(); 
    $email=$objWorksheet->getCellByColumnAndRow(4,$i)->getValue();
    $phone_number=$objWorksheet->getCellByColumnAndRow(5,$i)->getValue(); 
    $company=$objWorksheet->getCellByColumnAndRow(6,$i)->getValue(); 
    $input=array(
          'title'=>$title, 
          'first_name'=>$first_name,
          'last_name'=>$last_name,
          'date_of_birth'=>$date_of_birth,
          'email'=>$email,
          'phone_number'=>$phone_number,
          'company'=>$company,
     );
9

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`
0

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`
1

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`
2

7) Đã cố gắng gọi chức năng là http: //localhost/index.php/welcome/excel1

Đối với điều này, kết quả là màn hình trống, không có lỗi từ CI hoặc đến nhật ký Apache.

Đây là dòng giết chết nó:

Code:

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`
3

Bất kỳ ý tưởng nào tôi đang làm sai? Dù sao tôi cũng chưa chỉnh sửa PhpExcel, chỉ là các tệp gốc. Điều gì có thể gây ra điều này? Đọc về các phương pháp thực hiện khác nhau, nó dường như là một nhiệm vụ dễ dàng nhưng không phải. Apache liên quan?

Tất cả các ý tưởng là vô cùng được hoan nghênh.

  • El ForumGuest
    Guest
  • & nbsp;


. Để sửa nó, chèn mã sau vào index.php của bạn, ngay trước khi nhận xét có "tải tệp bootstrap", như dưới đây:
If you're not seeing any errors, that might be because of the server's configurations (it happened to me as well, in the past, many times). To fix it, insert the following code into your index.php, just before the comment that has "LOAD THE BOOTSTRAP FILE", as below:

Code:

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`
4

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`
5

Hãy cho tôi biết nếu điều đó làm cho các lỗi hiển thị.

  • El ForumGuest
    Guest
  • & nbsp;


[Eluser] Bonk [/Eluser] Cảm ơn Bruno!
Thanks Bruno!

Đây thực sự là bước đầu tiên để thực hiện công việc này.

Bây giờ tôi đang nhận được ngoại lệ này:

Code:

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`
6

Và từ autoloader.php, đây là cái này:

Code:

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`
7

Vì vậy, nó dường như là một vấn đề PHPHExcel, có suy nghĩ nào về điều này không?

  • El ForumGuest
    Guest
  • & nbsp;


[Eluser] Bonk [/Eluser] Cảm ơn Bruno!
Bruno,

Đây thực sự là bước đầu tiên để thực hiện công việc này.

Bây giờ tôi đang nhận được ngoại lệ này:

Và từ autoloader.php, đây là cái này:

Code:

   `$objPHPExcel = \PHPExcel_IOFactory::load("excel_files/temp_files.xlsx"));
    $objWorksheet = $objPHPExcel->getActiveSheet();
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = \PHPExcel_Cell::columnIndexFromString($objWorksheet->getHighestColumn());

    for ($row = 3; $row <= $highestRow; ++$row) {
        for($col = 0; $col <= $highestColumn; ++$col) {
            $cellValue = $objWorksheet->getCellByColumnAndRow($col, $row) ;
        }
    }`
8

Vì vậy, nó dường như là một vấn đề PHPHExcel, có suy nghĩ nào về điều này không?