@@ -221,21 +221,34 @@ class so that it can inherit all its methods.
221221 folders/files in **app/Controllers/ **, when a match wasn't found against defined routes.
222222 That's why your folders/files MUST start with a capital letter and the rest MUST be lowercase.
223223
224+ If you want another naming convention you need to manually define it using the
225+ :ref: `Defined Route Routing <defined-route-routing >`.
224226 Here is an example based on PSR-4 Autoloader:
225227
226228 .. literalinclude :: controllers/012.php
227229
228- If you want another naming convention you need to manually define it using the
229- :ref: `Defined Route Routing <defined-route-routing >`.
230-
231230Methods
232231=======
233232
233+ Method Visibility
234+ -----------------
235+
236+ When you define a method that is executable via HTTP request, the method must be
237+ declared as ``public ``.
238+
239+ .. warning :: For security reasons be sure to declare any new utility methods as ``protected`` or ``private``.
240+
241+ Default Method
242+ --------------
243+
234244In the above example, the method name is ``getIndex() ``.
235- The method (HTTP verb + ``Index() ``) is loaded if the **second segment ** of the URI is empty.
245+ The method (HTTP verb + ``Index() ``) is called the ** default method **, and is loaded if the **second segment ** of the URI is empty.
236246
237- **The second segment of the URI determines which method in the
238- controller gets called. **
247+ Normal Methods
248+ --------------
249+
250+ The second segment of the URI determines which method in the
251+ controller gets called.
239252
240253Let's try it. Add a new method to your controller:
241254
@@ -247,8 +260,6 @@ Now load the following URL to see the ``getComment()`` method::
247260
248261You should see your new message.
249262
250- .. warning :: For security reasons be sure to declare any new utility methods as ``protected`` or ``private``.
251-
252263Passing URI Segments to Your Methods
253264====================================
254265
@@ -263,6 +274,10 @@ Your method will be passed URI segments 3 and 4 (``'sandals'`` and ``'123'``):
263274
264275.. literalinclude :: controllers/022.php
265276
277+ .. note :: If there are more parameters in the URI than the method parameters,
278+ Auto Routing (Improved) does not execute the method, and it results in 404
279+ Not Found.
280+
266281Defining a Default Controller
267282=============================
268283
@@ -390,13 +405,12 @@ class so that it can inherit all its methods.
390405 folders/files in **app/Controllers/ **, when a match wasn't found against defined routes.
391406 That's why your folders/files MUST start with a capital letter and the rest MUST be lowercase.
392407
408+ If you want another naming convention you need to manually define it using the
409+ :ref: `Defined Route Routing <defined-route-routing >`.
393410 Here is an example based on PSR-4 Autoloader:
394411
395412 .. literalinclude :: controllers/012.php
396413
397- If you want another naming convention you need to manually define it using the
398- :ref: `Defined Route Routing <defined-route-routing >`.
399-
400414Methods
401415=======
402416
@@ -494,6 +508,8 @@ CodeIgniter also permits you to map your URIs using its :ref:`Defined Route Rout
494508Remapping Method Calls
495509**********************
496510
511+ .. note :: **Auto Routing (Improved)** does not support this feature intentionally.
512+
497513As noted above, the second segment of the URI typically determines which
498514method in the controller gets called. CodeIgniter permits you to override
499515this behavior through the use of the ``_remap() `` method:
0 commit comments