
PHPExcel 通过 PHPExcel_Shared_OLERead 类的 read 方法读取文件
但 read 方法里使用了 is_readable 函数来确认文件是否存在,而 is_readable 不能作用于 url
所以不可直接远程读取
但若绕过 is_readable 函数的话,就是可以的
public function read($sFileName)
{
// Check if file exists and is readable
if(!is_readable($sFileName)) {
throw new Exception("Could not open " $sFileName " for reading! File does not exist, or it is not readable");
}
// Get the file data
$this->data = file_get_contents($sFileName);
file_get_contents()比file()慢?
如果抓取别人的页面还是用file_get_contents()比较好~
file()取回的是数组
而file_get_contents()取回的是字符串
你是想取回个数组再把它们连起来方便?还是直接把他们取回来方便?
另外
file_get_contents(String,int)
有个可选参数设定读取的长度
在PHP手册中说:
file_get_contents() 函数是用来将文件的内容读入到一个字符串中的首选方法。如果 *** 作系统支持还会使用内存映射技术来增强性能。
很高兴回答楼主的问题 如有错误请见谅
<php
#### 此代码由 工具啦(>
以上就是关于PHP远程读取excel文件,怎么读取全部的内容,包括:PHP远程读取excel文件,怎么读取、求一个PHP请求远程页面获取响应内容的函数、php获取远程文件大小等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)