PHPExcel import file from url

2020-04-18 07:08发布

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);

1条回答
三岁会撩人
2楼-- · 2020-04-18 07:57

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.

查看更多
登录 后发表回答