标签:style tps win mysql reac eal public expect key
版本 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
PHP : CodeIgniter mysql_real_escape_string 警告
标签:style tps win mysql reac eal public expect key
原文地址:https://www.cnblogs.com/foxcharon/p/9396192.html