2014-05-20 3 views
2

내가 phpexcel을 사용하고 찾을 수 없습니다와 나는 문제가있다 : 독자 객체를 생성 할 때 내가이 오류 :PHPExcel은 'PHPExcel_Reader_excel.php은'

치명적인 오류 : 클래스 'PHPExcel_Reader_excel.php'C에서 찾을 수 없습니다 : \ XAMPP \ htdocs를 \ phpexcel \ 행에 pHPExcel \ IOFactory.php \ 클래스 170

내 코드는 다음과 같습니다

<?php 
require_once(dirname(__FILE__)."/Classes/phpexcel.php"); 
//or 
require_once(dirname(__FILE__)."/Classes/PHPExcel/IOFactory.php"); 
//$phpexcel = new PHPExcel(); 
$reader = PHPExcel_IOFactory::createReader("excel.php"); 
?> 

내가 라인 (170)에 IOFactory.php을 확인하고이 발견

$searchType = 'IReader'; 

    // Include class 
    foreach (self::$_searchLocations as $searchLocation) { 
     if ($searchLocation['type'] == $searchType) { 
      $className = str_replace('{0}', $readerType, $searchLocation['class']); 

      $instance = new $className(); 
      if ($instance !== NULL) { 
       return $instance; 
      } 
     } 
    } 

그러나 어떤 클래스도/대신 /를 사용하고 있기 때문에 찾을 수 없습니다 (경로는 phpexcel \ Classes \ PHPExcel \ Reader이고 excel5.php excel2007.php는 있지만 excel.php는 제외)

무엇이 잘못 되었나요? 문서가 조금 혼란 스럽다.

답변

4

PHPExcel_Reader_excel.php이라는 사용자 정의 독자를 추가하지 않은 경우 오류가 반환됩니다. 당신은 당신이 사용 이름으로 독자를 지정해야합니다

PHPExcel can read a number of different spreadsheet file formats, although not all features are supported by all of the readers. Check the Functionality Cross-Reference document (Functionality Cross-Reference.xls) for a list that identifies which features are supported by which readers.

Currently, PHPExcel supports the following File Types for Reading:

Excel5

The Microsoft Excel™ Binary file format (BIFF5 and BIFF8) is a binary file format that was used by Microsoft Excel™ between versions 95 and 2003. The format is supported (to various extents) by most spreadsheet programs. BIFF files normally have an extension of .xls. Documentation describing the format can be found online at http://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx or from http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/[MS-XLS].pdf (as a downloadable PDF).

Excel2003XML

Microsoft Excel™ 2003 included options for a file format called SpreadsheetML. This file is a zipped XML document. It is not very common, but its core features are supported. Documentation for the format can be found at http://msdn.microsoft.com/en-us/library/aa140066%28office.10%29.aspx though it’s sadly rather sparse in its detail.

Excel2007

Microsoft Excel™ 2007 shipped with a new file format, namely Microsoft Office Open XML SpreadsheetML, and Excel 2010 extended this still further with its new features such as sparklines. These files typically have an extension of .xlsx. This format is based around a zipped collection of eXtensible Markup Language (XML) files. Microsoft Office Open XML SpreadsheetML is mostly standardized in ECMA 376 (http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm) and ISO 29500.

OOCalc

aka Open Document Format (ODF) or OASIS, this is the OpenOffice.org XML File Format for spreadsheets. It comprises a zip archive including several components all of which are text files, most of these with markup in the eXtensible Markup Language (XML). It is the standard file format for OpenOffice.org Calc and StarCalc, and files typically have an extension of .ods. The published specification for the file format is available from the OASIS Open Office XML Format Technical Committee web page (http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office#technical). Other information is available from the OpenOffice.org XML File Format web page (http://xml.openoffice.org/general.html), part of the OpenOffice.org project.

SYLK

This is the Microsoft Multiplan Symbolic Link Interchange (SYLK) file format. Multiplan was a predecessor to Microsoft Excel™. Files normally have an extension of .slk. While not common, there are still a few applications that generate SYLK files as a cross-platform option, because (despite being limited to a single worksheet) it is a simple format to implement, and supports some basic data and cell formatting options (unlike CSV files).

Gnumeric

The Gnumeric file format is used by the Gnome Gnumeric spreadsheet application, and typically files have an extension of .gnumeric. The file contents are stored using eXtensible Markup Language (XML) markup, and the file is then compressed using the GNU project's gzip compression library. http://projects.gnome.org/gnumeric/doc/file-format-gnumeric.shtml

CSV

Comma Separated Value (CSV) file format is a common structuring strategy for text format files. In CSV flies, each line in the file represents a row of data and (within each line of the file) the different data fields (or columns) are separated from one another using a comma (“,”). If a data field contains a comma, then it should be enclosed (typically in quotation marks ("). Sometimes tabs “\t” or the pipe symbol (“|”) are used as separators instead of a comma. Because CSV is a text-only format, it doesn't support any data formatting options.

:

PHPExcel User Documentation - Reading Spreadsheet Files online의 섹션 1과 /Documentation 폴더에 설명한 바와 같이

, 7 개 개의 다른 독자는 7 개의 다른 스프레드 시트 형식에 사용할 수있다 createReader() 방법, 예를 들면 :

$reader = PHPExcel_IOFactory::createReader("Excel5"); 

/Examples FOL의 예를 많이

있습니다 다른 독자들에게이 사용법을 보여주는 것, PHPExcel 자체가 load()을 사용하여 정확한 판독기를 선택하게하고, identify() 방법을 사용하여 판독기를 설정하기 전에 파일이 올바른 형식인지 확인하기 위해

나는 고백해야한다. 이 문서가 포함 된 예제를 포함하여 매우 간단하다고 생각했습니다.

+0

내 바보 같은 질문에 대한 미안 해요, 나는 왜 내가이 방법에 대해 혼란스러워하는지 모르겠다 사실 tryint createReader ("excel.xls")하지만 내 코드를 입력하는 동안 실수를 저지른,하지만로드() 잘 작동 ... 감사합니다 – user2961204

0

더 쉽게 만들 수 있습니다. $ objReader = PHPExcel_IOFactory :: createReaderForFile ($ file); 그리고 자동으로 귀하의 파일에 대한 리더를 선택합니다