不要在 cakephp 3 中为某些功能使用布局

Man*_*dka 1 cakephp cakephp-3.0

我已经在 cakephp 3 中为我的项目定义了一些特定的布局。但我不需要某些功能的布局。如何禁用它。提前致谢!

Aar*_*bee 6

您可以在函数中使用它来删除默认布局:

$this->viewBuilder()->layout(false);
Run Code Online (Sandbox Code Playgroud)


小智 6

在 CakePHP 版本 >= 3.5 中,它是这个函数:

$this->viewBuilder()->enableAutoLayout(false);
Run Code Online (Sandbox Code Playgroud)