/** * Miscellaneous utility methods. */ final class Utils { private function __construct() { } /** * Get IP address * @return string IP address string */ public static function getIpAddress() { return $_SERVER["REMOTE_ADDR"]; } } ?> 复制代码 2、调用 $last_login_ip = Utils::getIpAddress(); ?> 复制代码