0

In this project, I have to get param from url in cakephp 3.x as the project documentation.

But it's strange given url in doc, it's like that (New param passing url)

www.example.com/param_name/param_value

I can get param value in old method parameter passing url like that below.

www.example.com?param_name=param_value

But in newer method using "/" instead of "?" and "=", I don't know how to get that param value.

1 Answer 1

1

in your routes.php

$routes->connect('/param_name/:param_value',['controller' => 'YourController','action' => 'view'])-> setPass(['param_value']);

in src/Controller/YourController.php

public function view($param_value)
{
   echo $param_value;
}
Sign up to request clarification or add additional context in comments.

1 Comment

in rout.php declare like that mean, is that ":" full column is need in url before param_value??? /param_name/:param_value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.