我有一个使用 CList 的基本功能 - 出于某种原因,我收到以下错误:
CList and its behaviors do not have a method or closure named "setReadOnly".
我的php代码
$list = new CList(array('python', 'ruby'));
$anotherList = new Clist(array('php'));
var_dump($list);
$list->mergeWith($anotherList);
var_dump($list);
$list->setReadOnly(true); // CList and its behaviors do not have a method or closure named "setReadOnly".
谁能解释我为什么会收到这个错误?
PS我直接从最近的一本Yii书中复制了这段代码......所以我有点困惑
// 更新:在 mergeWith() 前后添加了 var_dump
object(CList)[20]
private '_d' =>
array (size=2)
0 => string 'python' (length=6)
1 => string 'ruby' (length=4)
private '_c' => int 2
private '_r' => boolean false
private '_e' (CComponent) => null
private '_m' (CComponent) => null
object(CList)[20]
private '_d' =>
array (size=3)
0 => string 'python' (length=6)
1 => string 'ruby' (length=4)
2 => string 'php' (length=3)
private '_c' => int 3
private '_r' => boolean false
private '_e' (CComponent) => null
private '_m' (CComponent) => null