Skip to content

Commit

Permalink
docs: add e.g. for Retrieving the Controller and Method Names
Browse files Browse the repository at this point in the history
  • Loading branch information
datamweb committed Aug 17, 2024
1 parent a969827 commit d8953ad
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions user_guide_src/source/incoming/routing/071.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

use Config\Services;

// Get the router instance
$router = Services::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;

0 comments on commit d8953ad

Please sign in to comment.