首页 > 解决方案 > 显示不同的语言文本

问题描述

I'm new to HTML, and I want to display a message when JavaScript is disabled. So I put the message inside <noscript> tag, which works fine.

<noscript> Need to enable Javascript. </noscript>

But I want to change this language to Chinese when the browser language is Chinese. I can't use JavaScript because this message only displays when JavaScript is disabled. Is there any way to solve this? Thank you!

标签: javascripthtml

解决方案


当浏览器使用 PHP 发出 HTTP 请求时,它会发送标头。

因此,您可以尝试使用:

_SERVER["HTTP_ACCEPT_LANGUAGE"]

或者

_SERVER["HTTP_ACCEPT_CHARSET"]

推荐阅读