使用Silex框架进行路由

Hello everyone I would like to use the MicroFramework Silex to create the routing part of my website. The problem that I walk into is that I can't make it work since I don't really understand the documentation.

I have implemented the required files in my file tree and added some code into the index.php

this code is as follows:

$app = new Silex\Application(); 

$app->post('/web/{slug}', __DIR__.'/Controller/PostsController::showPost()');

$app->run();

I have also created a directory called Controller with the PostsController class in it. but now I don't know how to continue Can someone give me a simple example of how to create a dynamic routing that works with my Navigation class?

You are mixing filepath and class name / callback function. Second argument passed to post/get/match methods must be something that can be resolved to callable, so it can be lambda function, array of object/class and method name or string with function / class::method, ie.:

//Lambda
$app->get('/web/{slug}', function(){
        return \MyNamespace\Controler\PostControler::showPost();
    }
);    

//Static call
$app->get('/web/{slug}', array('\\MyNamespace\\Controler\\PostControler','showPost'));

//Object call
$myCtrl = new \MyNamespace\Controler\PostControler();
$app->get('/web/{slug}', array($myCtrl,'showPost'));

//Function
function showPost(){
    return \MyNamespace\Controler\PostControler\showPost();
}
$app->get('/web/{slug}', 'showPost');

//Both static and not methods
$app->get('/web/{slug}', '\\MyNamespace\\Controler\\PostControler::showPost');

When creating your own namespaces, remember to add them to autoloader