我想再次调用__construct函数在我班上通过PHP中的类的另一个函数再次调用构造类?
是这样的:
class user{
function __construct($ID = null)
{
if($ID){
//code
}
function findUser()
{
//code
$this->__construct($ID);
}
}
当然
,这并不工作,但什么是做这种正确的方法是什么?
`$ this - > __ construct($ ID)`will be working,you need按名称调用函数。当然,构造函数只能被调用一次。 [@zerkms](http://stackoverflow.com/questions/4505542/call-the-construct-class-again-trough-another-function-of-the-class-in-php/4505560#4505560)有权利回答。 – deceze 2010-12-22 01:55:38
这是行不通的,因为你错过了两个下划线。 – BoltClock 2010-12-22 01:59:37
这是一个错字:)我只是修复它 – Mars 2010-12-22 02:29:28