How can I use multiple PHP header content types on the same page? is this possible?

后端 未结 6 738
说谎
说谎 2020-12-06 21:38

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         


        
6条回答
  •  借酒劲吻你
    2020-12-06 22:29

    I do find it somewhat bizarre when people question why someone would want to do what they are asking in the initial question.

    Having spent a couple of hours working on alternative solutions, which didn't work, for a similar requirement to the OP, this is precisely what I needed.

    The usage I require is for displaying multiple images that are read from above the root and therefore not normally available via an IMG tag, so the solution that Erik has posted does the job beautifully and elegantly.

    
    

    You are able, as usual, to pass parameters to this wrapper file, in order that it finds the relevant image, creates a thumbnail version or whatever.

    In summary, excellent answer and thank you.

提交回复
热议问题