且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP版本升级导致类构造函数的问题

更新时间:2023-02-22 19:53:29

您可能使用类名称而不是 __ construct c $ c>关键字。请参阅v5.3.3中的行为更改:



http://www.php.net/archive/2010.php#id2010-07-22-2



使用 __ construct()就可以了。



http://www.php.net/manual/en/language.oop5.decon.php


I just upgraded my PHP version from v5.3.1 to v5.3.9. Suddenly class constructors started not working. Any ideas?

You are probably using constructors with Class name instead of __construct() keyword. See the behaviour change in v5.3.3 here:

http://www.php.net/archive/2010.php#id2010-07-22-2

Use __construct() and you should be fine.

http://www.php.net/manual/en/language.oop5.decon.php