问题描述
我已经实现了 WOPI 主机所需的 API,因为我现在正在尝试解决查看文档问题,我仅实现了 CheckFileInfo 和 GetFile 端点。
/wopi/files/{fileId}
$filePath = public_path('sample.docx');
$handle = fopen($filePath,"r");
$size = filesize($filePath);
$contents = fread($handle,$size);
return [
"BaseFileName" => "sample.docx","Size" => $size,"OwnerId" => 1,"UserId" => 1,"Version" => rand(),"FileUrl" => url("sample.docx")
];
/wopi/files/{fileId}/contents
$file = public_path('sample.docx');
return new BinaryFileResponse($file);
BinaryResponse 来自 - Symfony\Component\HttpFoundation\BinaryFileResponse
我尝试了多种实现来返回“文件的完整二进制内容”(为了满足这一点:https://wopi.readthedocs.io/projects/wopirest/en/latest/files/GetFile.html)
但我总是以以下错误告终。
旁注:我们注册了微软的云存储计划,域名为 www.**world.com,我在 test-wopi.**world.com
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)