はじめに どこでも使える共通関数を作ってCakePHP3で使いたい! どうしたらいいの?ってな時の使い方を紹介します。 ModelでもControllerでもViewでも使いたい、しかも楽に使いたいときの方法です。 手順 CakePHP3のroot配下にsrc/Utilsディレクトリを作成 /root /bin /config /logs /plugins /src/Utils <-ココ /tests /tmp /vendor /webroot .editorconfig .gitignore .htaccess .travis.yml composer.json index.php phpunit.xml.dist README.md
![CakePHP3で共通関数を作る方法 - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/92c938179ed561be8f184a106346018848a26137/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Fadvent-calendar-ogp-background-7940cd1c8db80a7ec40711d90f43539e.jpg%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTk3MiZoPTM3OCZ0eHQ9Q2FrZVBIUDMlRTMlODElQTclRTUlODUlQjElRTklODAlOUElRTklOTYlQTIlRTYlOTUlQjAlRTMlODIlOTIlRTQlQkQlOUMlRTMlODIlOEIlRTYlOTYlQjklRTYlQjMlOTUmdHh0LWFsaWduPWxlZnQlMkN0b3AmdHh0LWNvbG9yPSUyMzNBM0MzQyZ0eHQtZm9udD1IaXJhZ2lubyUyMFNhbnMlMjBXNiZ0eHQtc2l6ZT01NiZzPWU4OTY4NWYyNWU3OWFmMDc1ZDdmNTA3ODNkZjdjMDRk%26mark-x%3D120%26mark-y%3D96%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZoPTc2Jnc9OTcyJnR4dD0lNDB0c3VrYWJvJnR4dC1jb2xvcj0lMjMzQTNDM0MmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9MzYmdHh0LWFsaWduPWxlZnQlMkN0b3Amcz1iMmMyNjNlYmE4ZGZkNDY5NWYxZDUzM2Q1YWU5MjVhYQ%26blend-x%3D120%26blend-y%3D445%26blend-mode%3Dnormal%26txt64%3DaW4g5qCq5byP5Lya56S-RnVzaWM%26txt-width%3D972%26txt-clip%3Dend%252Cellipsis%26txt-color%3D%25233A3C3C%26txt-font%3DHiragino%2520Sans%2520W6%26txt-size%3D36%26txt-x%3D134%26txt-y%3D546%26s%3D0e12b7dc831100b1a55f33f302747c32)