来自url的PHPExcel导入文件 [英] PHPExcel import file from url
本文介绍了来自url的PHPExcel导入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从网站导入带有phpexcel的.tsv文件。使用语言环境文件,但如果我在http:// ...上更改文件位置,则不起作用。
i would like to import .tsv file with phpexcel from a website. With locale file is working, but if i change file location on "http://...", don't working.
$inputFileType = 'CSV';
$data = 'http://www.domain.com/file.tsv';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objReader->setDelimiter("\t");
$objPHPExcel = $objReader->load($data);
推荐答案
PHPExcel在打开文件之前使用file_exists()来测试文件它。 file_exists()需要stat()支持,该支持可用于有限的流包装子集,例如file:// ftp://和ssh2.sftp,但不适用于http://
PHPExcel uses file_exists() to test the file before opening it. file_exists() requires stat() support, which is available for a limited subset of stream wrappers such as file:// ftp:// and ssh2.sftp but is not available for http://
您需要先将文件拉到服务器的本地文件系统。
You'll need to pull the file to the server's local filesystem first.
这篇关于来自url的PHPExcel导入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文