2

Assume I have a login page (http://www.my-website.com/login/) and I want to block all users which access to login page base on their IP address except my own IP address. Could you help me to solve this issue?

Thanks in advance!

4

1 回答 1

5

在您的控制器中:

public function login() {
    if ($this->request->clientIp() != 'Your IP address here') {
        throw new ForbiddenException();
    }

    ...
}
于 2013-01-29T05:11:06.970 回答