Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果您直接从对 PHP 脚本的调用中输出图像,<img src="yourscript.php" />那么您将需要发送正确的Content-Type标头:
<img src="yourscript.php" />
Content-Type
header('Content-Length: '.filesize($yourimage)); header('Content-Type: image/png');
请注意,任何对header()的调用都必须在输出开始之前发生。