File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed
user_guide_src/source/incoming Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,23 @@ You can supply multiple verbs that a route should match by passing them in as an
47
47
48
48
.. literalinclude :: routing/004.php
49
49
50
+ Controller's Namespace
51
+ ======================
52
+
53
+ If a controller name is stated without beginning with ``\ ``, the :ref: `routing-default-namespace ` will be prepended:
54
+
55
+ .. literalinclude :: routing/063.php
56
+
57
+ If you put ``\ `` at the beginning, it is treated as a fully qualified class name:
58
+
59
+ .. literalinclude :: routing/064.php
60
+
61
+ You can also specify the namespace with the ``namespace `` option:
62
+
63
+ .. literalinclude :: routing/038.php
64
+
65
+ See :ref: `assigning-namespace ` for details.
66
+
50
67
Placeholders
51
68
============
52
69
@@ -394,7 +411,7 @@ You specify an array for the filter value:
394
411
Assigning Namespace
395
412
-------------------
396
413
397
- While a default namespace will be prepended to the generated controllers (see below) , you can also specify
414
+ While a :ref: ` routing- default- namespace` will be prepended to the generated controllers, you can also specify
398
415
a different namespace to be used in any options array, with the ``namespace `` option. The value should be the
399
416
namespace you want modified:
400
417
@@ -480,6 +497,8 @@ Routes Configuration Options
480
497
The RoutesCollection class provides several options that affect all routes, and can be modified to meet your
481
498
application's needs. These options are available at the top of **app/Config/Routes.php **.
482
499
500
+ .. _routing-default-namespace :
501
+
483
502
Default Namespace
484
503
=================
485
504
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ // Routes to \App\Controllers\Api\Users::update()
4
+ $ routes ->post ('api/users ' , 'Api\Users::update ' );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ // Routes to \Acme\Blog\Controllers\Home::list()
4
+ $ routes ->get ('blog ' , '\Acme\Blog\Controllers\Home::list ' );
You can’t perform that action at this time.
0 commit comments