Thinkphp3.2.2 front-and back-end public class architecture problems, thinkphp3.2.2 public _ PHP Tutorial

Source: Internet
Author: User
Thinkphp3.2.2 public class architecture problems in front and back, thinkphp3.2.2 public. Thinkphp3.2.2 front-end and back-end public class architecture problems. many projects before thinkphp3.2.2 public 3.13 use the front-end and back-end public classes. create Baseaction under libaction as a public inheritance class and discover thinkphp3.2.2 front-end public class architecture problems.

3.13 many projects used the front and back-end public classes before, and created the Baseaction under lib/action as the public inheritance class. it was found that many people in section 3.2.2 used the call, so that each time they used the call, it was very troublesome, xiao Bian is deliberately lazy. Use the following methods to solve the problem. Welcome to strengthen

Thinkphp3.2.2 creates Application/Common/Controller/BaseController. class. php

1
 Cfg (); 14} 15}

In Home/Controller/ZixunController. class. php

 lists();        dump($result);    }}

Of course, you can also create your own base class in the front and back ends, such as setting up AdminController in the background. class. php inherits BaseController. class. php. create HomeController on the frontend. class. php inherits BaseController. class. each php module inherits its own base class, so that the project can be clearer and avoid repeated wheel creation, saving a lot of things. However, note that each class must declare a namespace, however, the resources used can be defined in their respective base classes without being written once. For example, if AdminController. class. php inherits BaseController. class. php, you do not need to write use Think \ Controller. you can simply use Common \ Controller \ BaseController.

Before lifecycle 3.13, many projects used the front and back-end public classes. in lib/action, create Baseaction as the public inheritance class...

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.