html 文档字符编码未声明,加元标记UTF-8,但HTML文档的字符编码未声明仍然得到它...

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 be declared in the document or in the transfer protocol.

我已经在HMTL头加入。

如果我删除下面从HTML我的PHP代码,那么它的正常工作

注:$GET['Key']值来自URL(domain.com/details?key=uYxnJrS3aLv0JbJFLnnmW4TRRpF6%2FYB0JD6LUhPYu0U%3D)

if ($conn->real_escape_string($_GET['key'])){

$p_id=$conn->real_escape_string($_GET['key']);

$decrypted_p_id = decryptIt($p_id);

/*display single products*/

$sql_single_products="SELECT p_images, p_name, p_company, p_status FROM products WHERE p_id=?";

if ($stmt = $conn->prepare($sql_single_products)) {

$stmt->bind_param("i", $decrypted_p_id);

$stmt->execute();

$stmt->bind_result($p_images, $name,$company,$status);

$stmt->fetch();

}

}

下面是我的ID密码改到解密的功能和反之亦然

function encryptIt($q) {

$cryptKey = 'qJB0rGtIn5UB1xG03efyCp';

$qEncoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($cryptKey), $q, MCRYPT_MODE_CBC, md5(md5($cryptKey))));

return($qEncoded);

}

function decryptIt($q) {

$cryptKey = 'qJB0rGtIn5UB1xG03efyCp';

$qDecoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($cryptKey), base64_decode($q), MCRYPT_MODE_CBC, md5(md5($cryptKey))), "\0");

return($qDecoded);

}

Connection.php

$servername = "localhost";

$username = "user";

$password = "Pass#@123";

$dbname = "dbname";

// Create connection

$conn = new mysqli($servername, $username, $password, $dbname);

$conn->set_charset('utf8');

// Check connection

if ($conn->connect_error) {

die("Connection failed: " . $conn->connect_error);

}

在数据库连接文件中添加$conn->set_charset('utf8');越来越 也加入ini_set('display_errors', 1);然后我收到错误

Allowed memory size of 268435456 bytes exhausted (tried to allocate 4294967296 bytes)

+0

是你的数据库使用utf8的字符集? –

+0

我不知道。我应该在哪里设置它? –

+0

phpmyadmin,并看看你的数据库列表。在那里有关于字符集的信息 –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值