dtqu72830 2010-03-11 19: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 19: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条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改