php中file_get_contents把本地图片或远程图片直接直接输出浏览器

//$url = 'www.xx.com/?img';
$img = file_get_contents("./2.jpg",true);
header("Content-Type: image/jpeg;text/html; charset=utf-8");
echo $img;
exit;//这个不能少,否则乱码

 

你可能感兴趣的:(php)