0
点赞
收藏
分享

微信扫一扫

yii显示图片


yii显示图片

public function actionYzm()
{
//getCaptcha1.jpg
$imgFullPath = \Yii::getAlias('@webroot').'\img\yzm\getCaptcha1.jpg';
$response = \Yii::$app->getResponse();
// return $this->renderContent($imgFullPath);

$response->headers->set('Content-Type', 'image/jpeg');
$response->format = \Yii\web\Response::FORMAT_RAW;
$response->stream = fopen($imgFullPath, 'r');
return $response->send();
// return $response->sendFile($imgFullPath);

}

 

举报

相关推荐

0 条评论