Answer the question
In order to leave comments, you need to log in
How to parse cnc in php?
Here, for example, there is a self-written site with mvc structure.
Usually I did this: mysite.ru/catalog/group/id/1201/color/red which meant the catalog controller, the group action and the parameters id = 1201 and color = red. That is, all products of category 1201 with red color were searched in the catalog.
This is easy to parse.
And how, for example, to parse such a mysite/catalog/smartphone/yotaphone/yotaphone2-exclusive
For
my option, I would do mysite/catalog/view/product/12322
So, it turns out you need to constantly access the database.
What is the right way to do it here?
Answer the question
In order to leave comments, you need to log in
The author means that there is a variant in which the url with the specified controller and action does not make calls to the database. Example: display a static view of some page with a feedback form. It happens.
Answering the question: it would be possible to go in this way - the router class "looks" according to the classical scheme (the controller and all the internals), if there is none of this, then it "goes" to the database, where it finds the url and tries to figure out what to do with it. This is a simplified description.
There is also a variant of Bitrix, where the urls correspond to the file structure.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question