Differences between the thinkphp access controller and the event controller

Source: Internet
Author: User
Not very clear about the use of these two controllers? Can you give me a simple example of the explanation?

Reply content:

Not very clear about the use of these two controllers? Can you give me a simple example of the explanation?

Framework developers do not give any good explanations and explanations, basically by the developer's own understanding, do not need to limit the scope of the framework.

3.2.x began to enable more granular layering, Controller, Event, Model, Service, Logic ... For the main problem, in fact, TP recommendation is controller as "interaction with the outside" (personal understanding such as display view, accept form submission, etc.); event is only a response as an "internal event", usually only through a () To invoke (a personal understanding such as a controller needs to be provided to other controller interface methods, it is best to use the event). That's a bit of a detour.

I now use the EVENT because the front and back end of the separation, all requests are through Ajax, but the right to judge is not very good (such as the product list is not public, but can be selected in the form of goods), so it expands the two HTTP request method "event""event_ get", corresponding to the Read and list methods in the controller. The extended method is implemented by routing to someevent.

So say this thing, in fact, the matter, look at personal understanding, do not care about these details.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.