我想知道如何在没有任何模板的情况下从控制器返回图像.我想将它用于简报中的像素跟踪.
我从这段代码开始
$image = "1px.png";
$file = readfile("/path/to/my/image/1px.png");
$headers = array(
'Content-Type' => 'image/png',
'Content-Disposition' => 'inline; filename="'.$file.'"');
return new Response($image, 200, $headers);
Run Code Online (Sandbox Code Playgroud)
但在导航器上我有一个断开的链接(文件未找到...)