2
是否建議在throwing
之後執行exit;
或return;
cakeError?CakePHP:cakeError並退出
if (//successful operation)
{
echo 'YAY';
}
else
{
$this->cakeError('error404');
exit; // is it necessary?
}
是否建議在throwing
之後執行exit;
或return;
cakeError?CakePHP:cakeError並退出
if (//successful operation)
{
echo 'YAY';
}
else
{
$this->cakeError('error404');
exit; // is it necessary?
}
望着source code for ErrorHandler::error404(),在最後調用Object::_stop()
和its source code是
function _stop($status = 0) {
exit($status);
}
換句話說,不,你不必exit
調用cakeError()
,因爲它已經這樣做了。