建立与数据库的连接时WordPress出错

时间:2017-01-21 04:06:30

标签: php sql database wordpress

mrtechnic.com,我无法打开我的网站给我这个错误。

Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() in /srv/users/serverpilot/apps/mrtechnic/public/wp-content/themes/bimber/functions.php:60 Stack trace: #0 /srv/users/serverpilot/apps/mrtechnic/public/wp-settings.php(425): include() #1 /srv/users/serverpilot/apps/mrtechnic/public/wp-config.php(30): require_once('/srv/users/serv...') #2 /srv/users/serverpilot/apps/mrtechnic/public/wp-load.php(37): require_once('/srv/users/serv...') #3 /srv/users/serverpilot/apps/mrtechnic/public/wp-admin/maint/repair.php(10): require_once('/srv/users/serv...') #4 {main} thrown in /srv/users/serverpilot/apps/mrtechnic/public/wp-content/themes/bimber/functions.php on line 60

1 个答案:

答案 0 :(得分:1)

mysql_escape_string()是一个已弃用的函数,完全在PHP7中删除。您的错误是因为该功能不再可用。您需要更新代码。

请记住,在WordPress中,您不应该使用本机功能与数据库进行交互。请改用wpdb类。

WPDB:https://codex.wordpress.org/Class_Reference/wpdb

mysql_escape_string docs:http://php.net/manual/en/function.mysql-escape-string.php