【发布时间】:2017-07-03 17:08:47
【问题描述】:
public function actionFind()
{
$response = Yii::$app->response;
\Yii::$app->response->format = yii\web\Response::FORMAT_RAW;
\Yii::$app->response->headers->add('content-type', 'image/jpg');
$img_url = file_get_contents('images/ab.jpg');
Yii::$app->response->data($img_url);
return \Yii::$app->response;
}
为什么这段代码有错误??
错误是: 无法显示,因为它包含错误
【问题讨论】:
-
请显示错误..你的代码..还不够..添加动作/功能代码..
-
无法显示,因为它包含错误
-
我测试过:$img_url = file_get_contents('images/ab.jpg');我又遇到了错误
-
我想要创建链接,例如这个链接:manage.pyra.ir/…
-
如果您需要链接为什么要加载图像..您应该只指定路径