PHPexcel 出错 找不到PHPExcel类

浏览:3977 发布日期:2015/12/09 分类:求助交流 关键字: PHPExcel
1、ExcelController.class.php文件部分代码<?php
namespace Home\Controller;
use Think\Controller;

class ExcelController extends Controller {
    public function indexAction() {
        $this->display();
    }

    public function upexcelAction(){
     if (! empty ( $_FILES ['file_stu'] ['name'] )) 
     {
    $tmp_file = $_FILES ['file_stu'] ['tmp_name'];
    $file_types = explode ( ".", $_FILES ['file_stu'] ['name'] );
    $file_type = $file_types [count ( $file_types ) - 1];

     /*判别是不是.xls文件,判别是不是excel文件*/
     if (strtolower ( $file_type ) != "xls")              
     {
       $this->error ( '不是Excel文件,重新上传' );
     }

    /*设置上传路径*/
     $savePath = APP_PATH.'public/upfile/Excel/';
2、ExcelModel.class.php 部分文件代码 出错位置<?php
namespace  Home\Model;
use Think\Model;

class ExcelModel extends Model {
  protected $tableName = 'products_log';
  
  public function __construct() {
  
    /*导入phpExcel核心类 */
    require_once APP_PATH.'/PHPExcel/PHPExcel.php'; 
    require_once APP_PATH.'/PHPExcel/PHPExcel/Writer/Excel5.php';     // 用于其他低版本xls 
  require_once APP_PATH.'/PHPExcel/PHPExcel/Writer/Excel2007.php'; // 用于 excel-2007 格式 
  }


//导入excel内容转换成数组 
public function import($filePath){
  $this->__construct();
  $PHPExcel = new PHPExcel(); 
最后 new PHPExcel() 类出错
PHPExcel文件夹放在App应用下 也就是APP_PATH下
文件提交正确
当实例化PHPExcel 出错
Class 'Home\Model\PHPExcel' not found
最佳答案
评论() 相关
后面还有条评论,点击查看>>