为了兼容,将下面的代码入在总入口加载一下就好了
//$dbhost = DATA_HOST; $dbport = 3306; //$dbuser = DATA_USERNAME; //$dbpass = DATA_PASSWORD; //$dbname = DATA_NAME; if(!function_exists('mysql_connect')){ function mysql_connect($dbhost, $dbuser, $dbpass){ global $dbport; global $dbname; global $mysqli; $mysqli = mysqli_connect("$dbhost:$dbport", $dbuser, $dbpass, $dbname); return $mysqli; } function mysql_select_db($dbname){ global $mysqli; return mysqli_select_db($mysqli,$dbname); } function mysql_fetch_array($result){ return mysqli_fetch_array($result); } function mysql_fetch_assoc($result){ return mysqli_fetch_assoc($result); } function mysql_fetch_row($result){ return mysqli_fetch_row($result); } function mysql_query($query){ global $mysqli; return mysqli_query($mysqli,$query); } function mysql_escape_string($data){ global $mysqli; return mysqli_real_escape_string($mysqli, $data); } function mysql_real_escape_string($data){ return mysql_real_escape_string($data); } function mysql_close(){ global $mysqli; return mysqli_close($mysqli); } function mysql_error(){ global $mysqli; return mysqli_connect_error(); } function mysql_num_rows($data){ global $mysqli; return mysqli_num_rows($data); } function mysql_affected_rows(){ global $mysqli; return mysqli_affected_rows($mysqli); } }
版权声明:
此文为本站源创文章[或由本站编辑从网络整理改编],
转载请备注出处:
[狂码一生]
https://www.sindsun.com/articles/21/106
[若此文确切存在侵权,请联系本站管理员进行删除!]
--THE END--