类中如何调生成其它类对象
a.php
class a(){}
b.php
class b(){}
a中如何调用b类,并生成对象
public $b=new b();提示Parse error: syntax error, unexpected T_NEW
[解决办法]
在 a 的方法里
class a(){
public $b;
function __construct() {
$this->b = new b;
}
}
发布时间: 2013-01-04 10:04:13 作者: rapoo
类中如何调生成其它类对象
a.php
class a(){}
b.php
class b(){}
a中如何调用b类,并生成对象
public $b=new b();提示Parse error: syntax error, unexpected T_NEW
[解决办法]
在 a 的方法里
class a(){
public $b;
function __construct() {
$this->b = new b;
}
}