2
還這兩行:
$subForm = $this->{$spec}
$subForm = $spec;
public function prepareSubForm($spec)
{
if (is_string($spec)) {
$subForm = $this->{$spec};
} elseif ($spec instanceof Zend_Form_SubForm) {
$subForm = $spec;
} else {
throw new Exception('Invalid argument passed to ' .
__FUNCTION__ . '()');
}
$this->setSubFormDecorators($subForm)
->addSubmitButton($subForm)
->addSubFormActions($subForm);
return $subForm;
}
沒有區別 – JvdBerg
你可能會誤以爲'$此 - > $ spec'爲'$這個 - > spec',而它與'$這不太可能 - > {$規範}'。 – air4x