gpt4 book ai didi

php - 未声明 HTML 文档的字符编码

转载 作者:IT老高 更新时间:2023-10-28 11:45:10 27 4
gpt4 key购买 nike

当我点击表单的提交按钮时,会出现以下错误消息:

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.

插入.html:

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>insert page</title></head>
<body>
<h1> Insert Page </h1>
<form action="insert.php" method="post" enctype="application/x-www-form-urlencoded" >
<p>Title:<input type="text" name="title" size="40" /></p>
<p>Price:<input type= "text" name="price" size="40" /></p>
<p><input type="submit" value="Insert" />
<input type="reset" value="Reset" /></p>
</form>
</body>
</html>

插入.php:

<?php
$title = $_POST["title"];
$price = $_POST["price"];

echo $title;
?>

我不知道我的代码中的问题在哪里。请帮帮我。

最佳答案

将此添加为 HTML 模板的 HEAD 部分的第一行

<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">

Note: if any line between <head> and these meta line (Even if it's acommented note) problem will remain, so make sure you added meta lineafter <head> directly

关于php - 未声明 HTML 文档的字符编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11996257/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com