在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
版本 CodeIgniter 3 PHP 5.4 感谢万能的stackoverflow。 得修改CodeIgniter的源码。 ./system/database/drivers/mysql/mysql_driver.php /** * Escape String * * @access public * @param string * @param bool whether or not the string will be used in a LIKE condition * @return string */ function escape_str($str, $like = FALSE) { if (is_array($str)) { foreach ($str as $key => $val) { $str[$key] = $this->escape_str($val, $like); } return $str; } if (function_exists('mysql_real_escape_string') AND is_resource($this->conn_id)) { $str = mysql_real_escape_string($str, $this->conn_id); } elseif (function_exists('mysql_real_escape_string')) { if (is_object($this->conn_id)) { $str = mysql_real_escape_string($str, $this->conn_id); } else { $str = addslashes($str); } } elseif (function_exists('mysql_escape_string')) { $str = mysql_escape_string($str); } else { $str = addslashes($str); } // escape LIKE condition wildcards if ($like === TRUE) { $str = str_replace(array('%', '_'), array('\\%', '\\_'), $str); } return $str; } 斜体加下划线的就是修改过的部分。 参考:https://stackoverflow.com/questions/33995279/codeigniter-showing-error-mysql-real-escape-string-expects-parameter-2-to-be |
2022-07-18
2022-08-17
2022-11-06
2022-08-17
2022-08-15
请发表评论