要获取PHP用户信息,您可以使用$_SERVER
全局变量
$username = $_SERVER['PHP_AUTH_USER'];
echo "用户名: " . $username;
$password = $_SERVER['PHP_AUTH_PW'];
echo "密码: " . $password;
$ip_address = $_SERVER['REMOTE_ADDR'];
echo "IP地址: " . $ip_address;
$server_name = $_SERVER['SERVER_NAME'];
echo "服务器域名: " . $server_name;
$request_method = $_SERVER['REQUEST_METHOD'];
echo "请求方法: " . $request_method;
$script_path = $_SERVER['SCRIPT_FILENAME'];
echo "脚本路径: " . $script_path;
$http_user_agent = $_SERVER['HTTP_USER_AGENT'];
echo "用户代理: " . $http_user_agent;
这些示例展示了如何从$_SERVER
全局变量中提取有关用户和服务器的信息。请注意,某些信息可能需要根据您的应用程序进行适当的处理和验证。