1 <?php 2 $img_file = ‘test.png‘; 3 // $fp = fopen($img_file, ‘rb‘); 4 // $content = fread($fp, filesize($img_file)); //二进制数据 5 // fclose($fp); 6 // header(‘Content-Type: image/jpeg‘); 7 $content=file_get_contents($img_file); //二进制的流 8 header(‘Content-Type: image/jpeg‘); 9 echo $content; 10 ?>
时间: 2024-10-08 23:32:07