From 0cdd2996588e3f0c5383d35ece4c5e55a3fb601e Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 13 Nov 2023 07:05:13 +0900 Subject: [PATCH] docs: add about Controller returns string/Response --- user_guide_src/source/incoming/controllers.rst | 4 +++- user_guide_src/source/installation/upgrade_controllers.rst | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/incoming/controllers.rst b/user_guide_src/source/incoming/controllers.rst index bf5a747cb462..eda94fcf447a 100644 --- a/user_guide_src/source/incoming/controllers.rst +++ b/user_guide_src/source/incoming/controllers.rst @@ -11,7 +11,9 @@ Controllers are the heart of your application, as they determine how HTTP reques What is a Controller? ********************* -A Controller is simply a class file that handles a HTTP request. :doc:`URI Routing ` associates a URI with a controller. +A Controller is simply a class file that handles a HTTP request. +:doc:`URI Routing ` associates a URI with a controller. It returns a +view string or ``Response`` object. Every controller you create should extend ``BaseController`` class. This class provides several features that are available to all of your controllers. diff --git a/user_guide_src/source/installation/upgrade_controllers.rst b/user_guide_src/source/installation/upgrade_controllers.rst index cd5f17fd3d22..1a2dc9a9b4ce 100644 --- a/user_guide_src/source/installation/upgrade_controllers.rst +++ b/user_guide_src/source/installation/upgrade_controllers.rst @@ -20,6 +20,8 @@ What has been changed - CI4 provides :doc:`Request ` and :doc:`Responses ` objects for you to work with - more powerful than the CI3-way. - If you want a base controller (``MY_Controller`` in CI3), use **app/Controllers/BaseController.php**. +- Calling ``echo`` within Controllers, as in CI3, is still supported, but + it is recommended that a string or Response object be returned from Controllers. Upgrade Guide =============