【发布时间】:2014-12-22 23:50:41
【问题描述】:
我想通过 httpgoundation 响应发送简单的图像,从一个控制器到另一个控制器。这是我的代码:
$string = (string)md5(uniqid());
$string = substr($string, 0, $length);
$image = imagecreate(200, 50);
imagefill($image, 0, 0, "#000000");
$headers= array(
'Content-type'=>'image/jpeg',
'Pragma'=>'no-cache',
'Cache-Control'=>'no-cache'
);
$response = new Response( $image, 200, $headers );
return new Response($response);
错误为The Response content must be a string or object implementing __toString()。使用谷歌寻求答案我只发现想要从服务器(资产)某处返回文件的人。我应该怎么做才能让它工作?
【问题讨论】: