有没有办法将数组传递给类/对象构造并访问/返回或操作它?
代码:
$affiliates = array(
"clickbank" => "clickbankdata",
"meepbank" => array(
"meepbankdata" => "meep"
)
);
class Affiliate {
public $affiliates = array();
public function __construct($array) {
$this->affiliates = $array;
}
public function getAffiliatesArray() {
return $this->$affiliates;
}
}
$main = new Affiliate($affiliates);
print_r($main->getAffiliatesArray());