例子:
$Model->Behaviors->load('Some.Behaviour', $options);
// Now how do I get $options back from the model?
有没有办法得到$options
?$Model->actsAs
仍然是空的。
例子:
$Model->Behaviors->load('Some.Behaviour', $options);
// Now how do I get $options back from the model?
有没有办法得到$options
?$Model->actsAs
仍然是空的。
这些选项存储在settings
Behavior 本身的属性中。您可以通过以下方式获得它:
$this->Behaviors->Behavior->settings[''];
例如:
$this->Behaviors->load('Containable', array('hello' => 'world'));
var_dump($this->Behaviors->Containable->settings);
将返回:
array (size=2)
'priority' => int 10
'' =>
array (size=4)
'recursive' => boolean true
'notices' => boolean true
'autoFields' => boolean true
'hello' => string 'world' (length=5)
如您所见,“hello world 选项”就在底部。