我发送不同语言的缓存和内容类型 header 以显示正确的字符,但它不起作用。
header('Cache-control: private; Content-Type:text/html; charset=UTF-8');
我做错了什么?
最佳答案
您无法在一次 header()
调用中发送多个 header 。像这样分割它:
header('Cache-control: private;');
header('Content-Type:text/html; charset=UTF-8');
通常,当您发送 header 时,您会用换行符分隔它们,但如果您尝试使用 PHP 的 header()
函数执行此操作,则会收到警告:
Header may not contain more than a single header, new line detected
关于php - 在 PHP 中使用单个 header() 调用发送多个 HTTP header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32028837/