Greetings. If there are experts on this micro-framework, I will be grateful for the help.

I need to pass a parameter to the inside method of one class from the url string. If you believe the documentation, the parameter can be passed as follows:

Flight::route('/test/ @id ', function($id) { echo $id; }); 

But I need this parameter to be passed to the class method:

 Flight::route('/test/ @id ', array( 'class', 'method' )); 

Actually this is the question, how to do it? )

    2 answers 2

    Decided this way:

     Flight::route('/test/ @id ', ['class', 'method'], function($id){ $a = new class(); $a->method($id); }); 

    did not immediately think about it)

      You can achieve the desired result as follows:

       Flight::route('/test/@id', ['Test', 'testMethod']); class Test { function testMethod($id) { echo $id; } }