[英]How to display images in files folder from dreamfactory using php
我已将图片文件上传到Dreamfactory的文件夹中
<img src="https://motodev.spotya.online/api/v2/files/Posts/posts_1508937621_Tulips.jpg">
显示错误
{“错误”:{“代码”:400,“上下文”:null,“消息”:“在请求中未检测到会话令牌(JWT)或API密钥。”}
看来您在dreamfactory中的files
终结点已得到保护。 您需要提供API密钥或JWT令牌才能访问此目录中的文件。 另一种方法是来宾访问添加到您的files
的端点,描述在这里 。
您需要生成类似https://example.org/api/v2/files/image.jpg?api_key=<your api key>
网址。 例如:
<?php
// your guest API key
$apiKey = 'your api key should be here';
// your file URL
$baseUrl = 'https://example.org/api/v2/files/image.jpg';
// resulted URL
$finalUrl = $baseUrl . http_build_query(['api_key' => $apiKey]);
?>
<img src="<?= $finalUrl ?>">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.