代码{Login Signup form}中出现PHP弃用错误
我收到以下错误:代码{Login Signup form}中出现PHP弃用错误,php,fatal-error,Php,Fatal Error,我收到以下错误: 代码中的错误是什么 [27-May-2018 20:37:37 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; FGMembersite has a deprecated constructor in /home/gurudev/public_html/user/include/fg_membe
代码中的错误是什么
[27-May-2018 20:37:37 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; FGMembersite has a deprecated constructor in /home/gurudev/public_html/user/include/fg_membersite.php on line 24
[27-May-2018 20:37:37 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; FormValidator has a deprecated constructor in /home/gurudev/public_html/user/include/formvalidator.php on line 66
[27-May-2018 20:37:58 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; FGMembersite has a deprecated constructor in /home/gurudev/public_html/user/include/fg_membersite.php on line 24
[27-May-2018 20:37:58 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; FormValidator has a deprecated constructor in /home/gurudev/public_html/user/include/formvalidator.php on line 66
[27-May-2018 20:37:58 UTC] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/gurudev/public_html/user/include/fg_membersite.php:773
Stack trace:
#0 /home/gurudev/public_html/user/include/fg_membersite.php(729): FGMembersite->DBLogin()
#1 /home/gurudev/public_html/user/include/fg_membersite.php(86): FGMembersite->SaveToDatabase(Array)
#2 /home/gurudev/public_html/user/register.php(6): FGMembersite->RegisterUser()
#3 {main}
thrown in /home/gurudev/public_html/user/include/fg_membersite.php on line 773
源文件如下所示:
请检查您使用的PHP版本
mysql\u connect()
是PHP5的一部分
从官方网站引用:
警告
该扩展在PHP5.5.0中被弃用,在PHP7.0.0中被删除。相反,应该使用MySQLi
或PDO_-MySQL
扩展
如果仍要使用mysql\u connect()
,请使用包含PHP 5.x的相应服务器安装,例如
您可以轻松地将所有PHP5.x代码转换为PHP7.x。我个人在我的一些项目中使用过它,它就像一种魅力。但是在某个地方有你的原始代码的备份
[27-May-2018 20:37:37 UTC]PHP已弃用:同名方法
因为他们的类在未来的PHP版本中不会是构造函数;
FGMembersite中有一个已弃用的构造函数
/第24行的home/gurudev/public_html/user/include/fg_membersite.php
这意味着类的构造函数的命名方式在将来的版本中php将不再支持
class FGMembersite{
public function FGMemmbersite() : void{
echo "something";
}
}
class FGMembersite{
public function __construct() : void{
echo "something";
}
}
new FGMembersite();
两个类都会回显“something”,区别在于第一个类中的构造函数方法在未来的php版本中将不再工作,因为它与类本身同名;它必须是_u构造()
它警告您,您的代码可能会出现错误。代码属于此处,并且必须是最低版本。请删除不推荐使用的代码。代码中的错误是什么@smithNo不关注用户3783243的评论。不要在这里转储所有几千行代码。只有我们真正需要的,没有别的。例如第24行和第66行。很抱歉,您发布了一个确切的问题“PHP已弃用:在未来的PHP版本中,与类同名的方法将不会成为构造函数”;我不理解您不理解的内容。