Welcome Guest, Not a member yet? Register   Sign In
(:any) Route Placeholder Not Working?
#1

Documentation states that the (:any) placeholder should return the remainder of the URI string, but in my implementation, I only ever get the next segment. Everything after the proceeding / is truncated. Am I doing something wrong?

Routes.php -Route Definitions
Code:
$routes->get('auth/', 'Auth::index',['namespace' => 'IonAuth\Controllers']);
$routes->get('auth/login', 'Auth::login',['namespace' => 'IonAuth\Controllers']);
$routes->get('auth/logout', 'Auth::logout',['namespace' => 'IonAuth\Controllers']);
$routes->get('auth/forgot_password', 'Auth::forgot_password',['namespace' => 'IonAuth\Controllers']);

$routes->match(['get', 'post'], 'pages/create', 'Pages::create');
$routes->get('ajax/(:any)', 'Ajax::$1');
$routes->get('/', 'Pages::view');
$routes->get('(:any)', 'Pages::view/$1');

Pages->View() 
Code:
public function view($slug = null)
{
dd($slug);
}
 
If I enter a url like http://www.example.com/docs/tutorial

I would expect $slug to be "docs/tutorial"

Instead all I get is "docs";

Am I setting something up incorrectly? 

Thanks!
Reply


Messages In This Thread
(:any) Route Placeholder Not Working? - by MinimumViableProgrammer - 03-19-2020, 12:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB