我正在尝试将布局设置为 blank.ctp 但它不起作用,我在 src/Template/Layout 中创建了一个 blank.ctp 但以下代码不起作用,因为没有显示 blank.ctp 文件,默认布局是。
public function delete($id = null)
{
$this->request->allowMethod(['get']);
$this->loadModel('AdminLTETasks');
$adminLTETask = $this->AdminLTETasks->get($id);
if ($this->AdminLTETasks->delete($adminLTETask)) {
echo 'The admin l t e task has been deleted.';
} else {
echo 'The admin l t e task could not be deleted. Please, try again.';
}
$this->viewBuilder()->setLayout('blank');
}
我也尝试过不推荐使用的方法 layout('blank') 并且它也不起作用
public function delete($id = null)
{
$this->request->allowMethod(['get']);
$this->loadModel('AdminLTETasks');
$adminLTETask = $this->AdminLTETasks->get($id);
if($adminLTETask->user_id == $this->Auth->user('id')) {
if ($this->AdminLTETasks->delete($adminLTETask)) {
echo 'The admin l t e task has been deleted.';
} else {
echo 'The admin l t e task could not be deleted. Please, try again.';
}
}
$this->viewBuilder()->layout('blank');
}