forked from bradtraversy/php-crash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
09_superglobals.php
44 lines (42 loc) · 1.81 KB
/
09_superglobals.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/* ---------- Superglobals ---------- */
//Built in variables that are always available in all scopes
/*
$GLOBALS - A superglobal variable that holds information about any variables in global scope.
$_GET - Contains information about variables passed through a URL or a form.
$_POST - Contains information about variables passed through a form.
$_COOKIE - Contains information about variables passed through a cookie.
$_SESSION - Contains information about variables passed through a session.
$_SERVER - Contains information about the server environment.
$_ENV - Contains information about the environment variables.
$_FILES - Contains information about files uploaded to the script.
$_REQUEST - Contains information about variables passed through the form or URL.
*/
// var_dump($GLOBALS);
// var_dump($_GET);
// var_dump($_REQUEST);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<ul>
<li>Host: <?php echo $_SERVER['HTTP_HOST']; ?></li>
<li>Document Root: <?php echo $_SERVER['DOCUMENT_ROOT']; ?></li>
<li>System Root: <?php echo $_SERVER['SystemRoot']; ?></li>
<li>Server Name: <?php echo $_SERVER['SERVER_NAME']; ?></li>
<li>Server Port: <?php echo $_SERVER['SERVER_PORT']; ?></li>
<li>Current File Dir: <?php echo $_SERVER['PHP_SELF']; ?></li>
<li>Request URI: <?php echo $_SERVER['REQUEST_URI']; ?></li>
<li>Server Software: <?php echo $_SERVER['SERVER_SOFTWARE']; ?></li>
<li>Client Info: <?php echo $_SERVER['HTTP_USER_AGENT']; ?></li>
<li>Remote Address: <?php echo $_SERVER['REMOTE_ADDR']; ?></li>
<li>Remote Port: <?php echo $_SERVER['REMOTE_PORT']; ?></li>
</ul>
</body>
</html>