-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9129 from datamweb/docs-add-Retrieving-Controller…
…-MethodNames docs: add Getting Routing Information
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
// Get the router instance. | ||
/** @var \CodeIgniter\Router\Router $router */ | ||
$router = service('router'); | ||
|
||
// Retrieve the fully qualified class name of the controller handling the current request. | ||
$controller = $router->controllerName(); | ||
|
||
// Retrieve the method name being executed in the controller for the current request. | ||
$method = $router->methodName(); | ||
|
||
echo 'Current Controller: ' . $controller . '<br>'; | ||
echo 'Current Method: ' . $method; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
// Get the router instance. | ||
/** @var \CodeIgniter\Router\Router $router */ | ||
$router = service('router'); | ||
$filters = $router->getFilters(); | ||
|
||
echo 'Active Filters for the Route: ' . implode(', ', $filters); |