H
H
Human2020-06-17 23:22:28
PHP
Human, 2020-06-17 23:22:28

Is it normal when the router gives out so much information?

'route' => ['type', 'name', 'path', 'url', 'matches', 'controller', 'action']

'/blog/{id}' => ['module', 'Blog', 'modules/blog/', '/blog/post-name', ['id' => 'post-name'], 'post', 'show']

type - app, module...
path - path to the application's root folder. This is how the app/, modules/blog/, modules/commerce/... paths look like
url - the actual current url
mathces - id (user/{id})

type and path I get when collecting routes, url and matches when comparing, and controller and action were originally in the file with routes.

Example, getting a config file:
$config = $array['path'] . 'config/' . $name . '.php';

If not, how to get type and path?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question