PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, October 5, 2022

[FIXED] how to use phpexcel in zend framework

 October 05, 2022     phpexcel, zend-autoloader, zend-framework     No comments   

Issue

I need to import data from excel,And the I decided to use PHPExcel,But when I require it in my web , a few warnings occured :

      Warning: 
    include_once(PHPExcel\Shared\ZipStreamWrapper.php) [<a href='function.include-once'>function.include-once</a>]: 
failed to open stream: No such file or directory in D:\www\LearningCenter\library\Zend\Loader.php on line 146

here is my code.:

public function getUserFromExcel($path){
    echo $path;
    require_once 'Excel/PHPExcel.php'; 
    echo $path;
}

and my webapp structre is :

library Zend Excel others-thirdpart-library

it seems that there is something wrong with the autoloader.

I read a few articles But did not find a solution.

My final aim is to read date from an excel file: can some one give me some sugestion on ether how to use phpexcel in zend or how to import data from excel useing zend itself.

thanks


Solution

copy the PHPExcel library into your /library directory, the structure should be as follows

/library
    /PHPExcel
    /PHPExcel.php

and then add this in your application.ini

autoloaderNamespaces[] = "PHPExcel_"
autoloaderNamespaces[] = "PHPExcel"

and it should work.



Answered By - Ibrahim Azhar Armar
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing