假设我有一个登录页面(http://www.my-website.com/login/),我想阻止所有访问登录页面的用户,除了我自己的IP地址之外,还要访问他们的IP地址。你能帮我解决这个问题吗?
提前致谢!
答案 0 :(得分:5)
在您的控制器中:
public function login() {
if ($this->request->clientIp() != 'Your IP address here') {
throw new ForbiddenException();
}
...
}