Answer the question
In order to leave comments, you need to log in
How to implement localization in PHP MVC?
Hello!
Tell me how to implement localization via URL in MVC pattern in PHP?
In this form:
site.com/locale/contacts Many
thanks in advance!
PS At least the question is where and how to extract the locale from the URL.
Answer the question
In order to leave comments, you need to log in
You need to extract it in the router, if I correctly understood the goals.
$url = trim($_SERVER['REQUEST_URI'], '/');
$pos = strripos($url, "?");
if ($pos)
$url = stristr($url, '?', true);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question