php默认标头(php default header)

编程入门 行业动态 更新时间:2024-10-26 13:22:16
php默认标头(php default header)

是否有任何特定的标题我应该为纯PHP页面服务?

我没有重定向用户或类似的东西,我的标记已经有一个doctype和<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

我还需要从PHP header()吗? 它应该有什么具体的东西吗?

Is there any specific header I should be serving for plain php pages?

I'm not redirecting the user or anything like that and my markup already has a doctype and <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Do I also need to start with a PHP header()? Is there anything specific that it should have?

最满意答案

header()用于发送HTTP头。 如果你问,你可能还不需要它,尽管你可以通过这样做来摆脱你的meta :

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

请记住, header()指令必须都在发送任何内容之前,否则您将收到错误。

header() is for sending HTTP headers. If you're asking, you probably don't need it yet, though you could get rid of your meta by doing:

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

Remember that header() directives must all come before any content has been sent, otherwise you will get errors.

更多推荐

本文发布于:2023-08-01 02:34:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1354032.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:php   default   header

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!