读取本地文件没问题。换成读取web文件
Could not open xxx.xls for reading! File does not exist.file_exists报错。 如果改成file_get_contents() 取出的数据又不正常。求解决方案
Could not open xxx.xls for reading! File does not exist.file_exists报错。 如果改成file_get_contents() 取出的数据又不正常。求解决方案
{
// 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);
是先
if (!file_exists($pFilename)) {
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
}这里就报错 我加了句 !file_exists($pFilename) && ! file_get_contents('xxx')这里不报错了 。
紧接着下面执行
$ole = new PHPExcel_Shared_OLERead(); // get excel data
$res = $ole->read($pFilename);这里是read方法
if(!is_readable($sFileName)) {
throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
}这里就又报错了。没看到$this->data = file_get_contents($sFileName); 请问这个在哪 没搜到。。莫非版本改了?
还是应该先读回到本地临时文件比较稳妥