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

QQ截图20170622154616.png

At this time When we directly access the route, it will prompt

QQ截图20170621151016.png

#, so our public controller is completed.

Continuing Learning
||
error('请先登录在访问',U('Login/index')); } } }
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!