dtqu72830 2010-03-11 11:28
浏览 231
已采纳

如何在同一页面上使用多个PHP标头内容类型? 这可能吗?

Is it possible to use multiple header types in one document? For example:

header("Content-type: image/jpeg");
header('Content-Type: text/html; charset=utf-8');

returns the whole page as text/html... while

header('Content-Type: text/html; charset=utf-8');
header("Content-type: image/jpeg");

Returns the whole page as an image.... How can I use both types of content on the same page? I'm using ob_start() at the top and ob_end_flush() at the beginning.

  • 写回答

6条回答 默认 最新

  • dongyi6668 2010-03-11 11:31
    关注

    You can't. But what you can do is something like this in your HTML:

    <img src="my_img.php" />
    

    Of course my_img.php would be a PHP file that has a header("Content-type: image/jpeg"); line, and outputs your image.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部