gpt4 book ai didi

php - 链接标识符在 mysql_real_escape_string() 中的重要性

转载 作者:可可西里 更新时间:2023-11-01 07:48:36 25 4
gpt4 key购买 nike

为什么在使用 mysql_real_escape_string() 时需要将链接标识符作为输入。我知道该函数应该与 MySQL 查询一起使用,但该函数实际上只是一个字符串操作。

最佳答案

来自 the PHP manual :

Escapes special characters in the unescaped_string , taking into account the current character set of the connection so that it is safe to place it in a mysql_query(). If binary data is to be inserted, this function must be used.

和:

If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If no connection is found or established, an E_WARNING level error is generated.

需要一个连接来确定字符集。

关于php - 链接标识符在 mysql_real_escape_string() 中的重要性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1977886/

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