doucong1853 2019-06-25 11:53
浏览 205


I am working on a project, in which XLS file needs to be uploaded to the server and extract its content. When I worked on my localhost it was working perfectly, but after I uploaded the project on the server, phpSpreadSheet library started not working. I checked the error_log file in the server and noticed that the following error has appeared.

PHP Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in 'vendor/markbaker/complex/classes/src/operations/add.php' 

I think that I do not have any error in my code as the library was working in my localhost without errors.

 $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');

 $spreadsheet = $reader->load(strip_tags($file_path));

 $worksheet = $spreadsheet->getActiveSheet();

        $highestRow = $worksheet->getHighestRow();
        $highestColumn = $worksheet->getHighestColumn();

        $data = $worksheet->rangeToArray(
            'A1:' . $highestColumn . '1',
  • 写回答

1条回答 默认 最新

  • douhuxi4145 2019-06-26 10:00

    After a long search, I solved the issue by upgrading the php version on the server. Php version on the server was 5.4 and it was causing the problem, phpSpreadSheet software requirement shows that supported PHP version is 5.6 or newer.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 #求带 python,使用pycharm爬取智联招聘数据资源并保存为Excel文件,同时以图表形式呈现
  • ¥15 学校优化算法怎么样,国内用的多吗?
  • ¥15 微信购物商城购物车的所有功能以及购物车,和首页的搜索功能
  • ¥40 servlet的web程序部署出错
  • ¥50 activiti 新建流程系列问题
  • ¥50 为什么我版本升级之后运行速度变慢5倍??
  • ¥15 如何在gazebo中加载机械臂和机械手
  • ¥15 纯运放实现隔离采样方案设计
  • ¥20 easyconnect无法连接后缀带.com的网站,一直显示找不到服务器ip地址,但是带有数字的网站又是可以连接上的,如何解决
  • ¥15 电脑开机过商标后就直接这样,求解各位