PHP 变量

前提条件,本地机器作为服务器启动,输入下面的命令行。

php -S localhost:4000

PHP 变量

 

1.site.php

PHP 变量

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <?php
      $characterName = "John";
      $characterAge=35;
      echo "There once was a man named $characterName<br>";
      echo "He was $characterAge years old<br>";
      echo "He really liked the name $characterName<br>";
      echo "But did not like the age being $characterAge<br>";
    ?>
  </body>
</html>

2.

http://localhost:4000/www/site.php

PHP 变量

 

PHP 变量