Create a public controller
We have created background verification, but we can still access it directly by directly entering the routing address. How should we solve this problem?
We use the __construct constructor, which can be called when the class is instantiated.
CommonController.class.php
error('请先登录在访问',U('Login/index')); } } }
We need to inherit this CommonController.class.php controller on each page
At this time When we directly access the route, it will prompt
#, so our public controller is completed.