Good day to all! I know, I know, the question is asked very nekkorektno, but now I will try to quickly explain what interests me. I am learning php, I try to find sources myself and solve my problems, but this time something is frozen. Essence: How to add a new topic to a website so that the id is displayed in the browser, like mysite.com/topics/245646 For example, here is the user's address: https://geekbrains.ru/users/2234673 the movie. https://www.kinopoisk.ru/film/726753/

Tell me where to look, and even better if there are references to tutorials (available in English)! Thank you all so much!

Closed due to the fact that the issue is too general for the participants Dmitriy Simushev , Denis Bubnov , Akina , aleksandr barakin , Vadim Ovchinnikov 2 Feb '17 at 15:52 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

1 answer 1

To do this, you can use one of the libraries for routing, for example klein php

The code looks like this

$klein = new \Klein\Klein(); $klein->respond('GET', '/topic/[i:id]', function ($request) { return "Вы указали id = " . $request->param('id'); }); $klein->dispatch(); 

It is also necessary to configure your web server so that it redirects all requests for non-existent resources to your script (for example, index.php) in which requests with the above code will be processed