1 把phpExcel的工具类上传到Sae的云服务器
2 然后你要在Storage 上创建一个Bucket ,名字你可以自己起。
3 上代码
use sinacloud\sae\Storage as Storage;
$s=new SaeStorage(); // 到此为止呢,如果不明白什么意思,去参考新浪云的文档
$filename=$_FILES['my_file']['name']; //这个地方是接受从前端传过来的文件名字,为什么要它的名字,在下边的代码中需要用到
$destination="saestor://test/upload/{$filename}"; // saestor 这个东西表示,你可以修改Storage中的东西。test 表示你的上边bucket 的名字,upload是在test下边建立的文件夹,当然你可以自己新建一个自己命名的,后边的filename呢,就是上文提到的用处。
file_put_contents( SAE_TMP_PATH . "/{$filename}" ,$s->read('test',"upload/{$filename}") ); // 这段代码的意思就是:把test中的文件读到sae的缓存文件中。
$objPHPExcel = PHPExcel_IOFactory::load( SAE_TMP_PATH ."/{$filename}"); // 这个地方是phpExcel 加载文件的地方