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...