php包含文件 变量

2024-02-15 17:10:16

```php

include 'header.php';

// your code here...

include 'footer.php';

?>

```

在这个例子中,'header.php'和'footer.php'可能包含了我司经常使用的HTML代码,如页眉和页脚。

```php

$name = "John Doe";

echo "Hello, " . $name;

?>

```

在这个例子中定义了个名为$name的变量,赋予它个字符串"John Doe"在echo语句中使用了这个变量。