我已尝试正常获取数据,但在json响应中显示图像字段中的错误。下面的代码是对的??
public function up()
{
Schema::create('admin', function (Blueprint $table) {
$table->increments('id');
$table->string('username');
$table->string('password');
$table->string('profile_pic');
});
并获取代码以下的数据
public function log() {
$users = AdminLogin::all();
return response()->json($users);
}
答案 0 :(得分:0)
$photo = $this->uploadFile->get_by_photo($photo, ['filename']);
$path = storage_path('app') . '/' . $photo[0]['filename'];
$type = File::mimeType($path);
$headers = array('Content-Type' => $type);
$response = response()->download($path, $photo, $headers); ob_end_clean();
return $response;