简体   繁体   English

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

[英]Error in WordPress while establishing connection to database

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

mysql_escape_string() is a deprecated function that was removed entirely in PHP7. mysql_escape_string()是一个不推荐使用的函数,它在 PHP7 中被完全删除。 Your error is because that function is no longer available.您的错误是因为该功能不再可用。 You need to update the code.您需要更新代码。

Keep in mind that in WordPress you shouldn't be interacting with the database using native functions.请记住,在 WordPress 中,您不应使用本机函数与数据库进行交互。 Use the wpdb class instead.请改用wpdb类。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM