简体   繁体   English

如果PHP发送两个标头,哪个有效?

[英]If PHP sends two headers, which will be effective?

If I have two headers like: 如果我有两个标题,例如:

header("Cache-Control: public");
header("Cache-Control: private");

Which will be effective (first or last)? 哪个有效(第一个或最后一个)?

On this script the second header() will be used: 在此脚本中,将使用第二个header():

<?php
    header('Location: http://google.de');
    header('Location: http://stackoverflow.com');

On your script the second header() will be used: 在脚本上,将使用第二个header():

<?php
    header("Cache-Control: public");
    header("Cache-Control: private");

If a header was defined multiple times, the last one will be used! 如果头被多次定义,将使用最后一个头!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM