// backEnd/index.php
<?php include "server-info.php" ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.5.0/css/bootstrap.min.css">
<title>php教程</title>
</head>
<body>
<div class="container">
<h2>服务器端的配置信息</h2>
<?php if($server): ?>
<ul class="list-group">
<?php foreach($server as $key => $value): ?>
<li class="list-group-item">
<strong>
<?php echo $key ?> : <?php echo $value ?>
</strong>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<h2>客户端的配置信息</h2>
<?php if($client): ?>
<ul class="list-group">
<?php foreach($client as $key => $value): ?>
<li class="list-group-item">
<strong>
<?php echo $key ?> : <?php echo $value ?>
</strong>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</body>
</html>
// backEnd/server-info.php
<?php
#创建服务器数组信息
$server = [
"host server name" => $_SERVER["SERVER_NAME"],
"server software" => $_SERVER["SERVER_SOFTWARE"],
"document root" => $_SERVER["DOCUMENT_ROOT"],
"http host" => $_SERVER["HTTP_HOST"],
"script name" => $_SERVER["SCRIPT_NAME"],
"absolute path" => $_SERVER["SCRIPT_FILENAME"],
"current page" => $_SERVER["PATH_SELF"]
];
#echo $server["server software"];
// print_r($server);
#创建客户端数组信息
$client = [
"client system info" => $_SERVER["HTTP_USER_AGENT"],
"client ip" => $_SERVER["REMOTE_ADDR"],
"remote port" => $_SERVER["REMOTE_PORT"]
];
?>