我正在编写一个php脚本,该脚本请求其他DF服务,即文件。当我要求包含文件的文件夹时,响应正确,但是我想直接请求文件(JSON或XML)有一个错误:
df日志:
local.ERROR: Type error: Argument 1 passed to DreamFactoryCoreUtilityResponseFactory::sendScriptResponse() must implement interface DreamFactoryCoreContractsServiceResponseInterface, instance of SymfonyComponentHttpFoundationStreamedResponse given, called in D:socle_64dreamfactory-2.12.0appsdreamfactoryhtdocsvendordreamfactorydf-scriptsrcComponentsBaseEngineAdapter.php
php脚本看起来像这样:
$platform['api']->get->__invoke('service/file');
当我仅通过通往包含文件的文件夹路径时,它运行良好。通过Postman或我的DF服务的同样请求效果很好。
谢谢
PS:对不起,我的英语。
我找到了问题解决方案:
$result = $platform['api']->get->__invoke('service/file.txt?include_properties=true&content=true');
=>返回文件内容base64编码
$file = base64_decode($response['content'], true);