CakePHP 3.x - Load CSS in head tag for a specific action

♀尐吖头ヾ 提交于 2019-11-29 16:25:17

In your template, this can be achieved by linking to the css file using the block option:

Creates a link(s) to a CSS style-sheet. If the block option is set to true, the link tags are added to the css block which you can print inside the head tag of the document.

I.e. anywhere in the relevant template:

$this->Html->css('special', ['block' => true]);

This is output by the fetch call in the layout:

<?= $this->fetch('css') ?>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!