Codeigniter调用PHPExcel问题

ding314127 2009-03-06 02:25:16
最近一直在研究使用Codeigniter控制器调用PHPExcel类的问题。
网上有两篇参考文章,
在Codeigniter中使用ZEND http://www.beyondcoding.com/2008/02/21/using-zend-framework-with-codeigniter/
在Codeigniter中使用Pear blog.lemonfz.com/articles/codeigniter-in-the-use-of-pear-library-solution.html

大家帮我想想怎么调用PHPExcel。
...全文
442 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
hww_luck 2010-10-11
  • 打赏
  • 举报
回复
出现乱码,如何解决的啊?
hww_luck 2010-10-11
  • 打赏
  • 举报
回复
咋就没了下文?
ruanchao 2009-03-31
  • 打赏
  • 举报
回复
俺也不懂,继续关注一下。
yctin 2009-03-10
  • 打赏
  • 举报
回复
看别人文章不要全抄
抽取自己需要的部份就可以了

他那个下载header有问题的
用你原来成功的取代这部份就行了
fxs_2008 2009-03-10
  • 打赏
  • 举报
回复
个人了解,目前仍没有好用的操作excel的组件或类
ding314127 2009-03-10
  • 打赏
  • 举报
回复
这个问题我解决了。我查了一下资料是'/'的问题。linux路径用'/',而windows下用'\'.多谢。
不过出现了一个新问题。
function send_to_browser($filename = "workbook.xls", $format = 'Excel5'){
// load the appropriate IO Factory writer
$objWriter = PHPExcel_IOFactory::createWriter($this->workbook, $format);
// output the appropriate headers
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream');
header('Content-Type: application/download');
header("Content-Disposition: attachment;filename=$filename");
header('Content-Transfer-Encoding: binary');

// output the file
$objWriter->save('php://output');
return; // end processing

}


这段代码没有出现保存对话框,却全是乱码。
以前我没用Codeigniter时也出现过这种情况,网友让我在$objWriter->save('php://output');后加一句 exit;就好了。不过这次我加上后还是乱码。
求解。
PS:我已经提高了问题分数。
ding314127 2009-03-10
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 yctin 的回复:]
看别人文章不要全抄
抽取自己需要的部份就可以了

他那个下载header有问题的
用你原来成功的取代这部份就行了
[/Quote]

我试过了,仍然只是乱码?
感觉应该是CI的问题。CI官网也有人出现了这问题。
自己研究ing,并继续关注此问题。
yctin 2009-03-09
  • 打赏
  • 举报
回复
$library_dir 改成相对路径就应该可以了
ding314127 2009-03-09
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 yctin 的回复:]
http://techxplorer.com/2008/12/08/using-phpexcel-with-codeigniter/
[/Quote]
恩,我按上面的配置了,但是调用的使用提示错误
A PHP Error was encountered
Severity: Warning

Message: Excel::require_once(/PHPExcel/PHPExcel.php) [function.Excel-require-once]: failed to open stream: No such file or directory

Filename: libraries/Excel.php

Line Number: 18


Fatal error: Excel::require_once() [function.require]: Failed opening required '/PHPExcel/PHPExcel.php' (include_path='C:\AppServ\www\manpower\system\application\libraries;/PHPExcel/') in C:\AppServ\www\manpower\system\application\libraries\Excel.php on line 18

个人感觉应该是路径的问题。楼上给的地址里的路径应该是linux的,我是在windows下配置。不懂linux。所以再请问一下楼上我应该怎么改呀?多谢。
yctin 2009-03-06
  • 打赏
  • 举报
回复
http://techxplorer.com/2008/12/08/using-phpexcel-with-codeigniter/
jim8590251 2009-03-06
  • 打赏
  • 举报
回复
没遇到过
不清楚,帮顶了...

4,251

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧