0

我正在编写一个请求其他 DF 服务的 PHP 脚本,它是一个 FileStorage。当我请求包含该文件的文件夹时,响应是正确的,但是当我想直接请求一个文件(json 或 xml)时,会出现错误:

东风日志:

local.ERROR: Type error: Argument 1 passed to DreamFactory\Core\Utility\ResponseFactory::sendScriptResponse() must implement interface DreamFactory\Core\Contracts\ServiceResponseInterface, instance of Symfony\Component\HttpFoundation\StreamedResponse given, called in D:\socle_64\dreamfactory-2.12.0\apps\dreamfactory\htdocs\vendor\dreamfactory\df-script\src\Components\BaseEngineAdapter.php

PHP 脚本如下所示:

$platform['api']->get->__invoke('service/file');

当我只传递包含文件的文件夹的路径时,它运行良好。通过邮递员或我的 DF 服务之外的相同请求效果很好。

谢谢

PS:对不起我的英语。

4

1 回答 1

0

好吧,我找到了问题解决方案:

$result = $platform['api']->get->__invoke('service/file.txt?include_properties=true&content=true');

=> 返回文件内容 base64 编码

$file = base64_decode($response['content'], true);
于 2019-03-21T10:00:26.903 回答