Use? (question mark) instead of / with Slim Framework

I'm just trying to figure out how to use a question mark with a url like:

http://localhost/AllOfCats/index.php?m=something

      

How I tried:

$app->get('/', function() use ($app) {
     $req = $app->request(); $m= $req->get('m');
     echo "GET route : $m"; });

      

But unfortunately it didn't work. Do you know, why?

Many thanks.

+3


source to share


1 answer


I installed the app and tested it and it works fine. Make sure your application is configured correctly in your application. Your application should look something like this. Make sure you don't skip the boiler plate code to set up fine work and run the application.



<?php
require 'vendor/autoload.php';

$app = new \Slim\Slim();

$app->get('/', function() use ($app) {
    $req = $app->request(); $m= $req->get('m');
    echo "GET route : $m"; });

$app->run();

      

+1


source







All Articles