<!DOCTYPE html> <html> <body> <?php $x = 75; $y = 25; function addition() { $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y']; } addition(); echo $z; ?> </body> </html>
<!DOCTYPE html> <html> <body> <?php echo $_SERVER['PHP_SELF']; echo "<br>"; echo $_SERVER['SERVER_NAME']; echo "<br>"; echo $_SERVER['HTTP_HOST']; echo "<br>"; echo $_SERVER['HTTP_REFERER']; echo "<br>"; echo $_SERVER['HTTP_USER_AGENT']; echo "<br>"; echo $_SERVER['SCRIPT_NAME']; ?> </body> </html>
<!DOCTYPE html> <html> <body> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> Name: <input type="text" name="fname"> <input type="submit"> </form> <?php $name = htmlspecialchars($_REQUEST['fname']); echo $name; ?> </body> </html>
<!DOCTYPE html>
<html>
<body>
<a href="test_get.php?subject=PHP&web=runoob.com">测试 $_GET</a>
</body>
</html>