4
在PHP中使用__set訪問函數我可以設置標量的值,但不能設置數組的元素。即:PHP訪問函數和數組
$p->scalavar = "Hello"; // This works fine
$p->myarray['title'] = "Hello"; //This does not work
我訪問如下:
function __set($mbr_name, $mbr_value) {
$this->$mbr_name = $mbr_value;
}
謝謝!