require

创建于 2024-12-03 / 50
字体: [默认] [大] [更大]

❮ PHP 关键字

实例

使用 require 为页面添加页脚:

<!DOCTYPE html>
<html>
<body>

<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<p>Some more text.</p>
<?php require 'footer.php';?>

</body>
</html>

定义和用法

require 关键字用于从另一个文件嵌入 PHP 代码。 如果找不到该文件,则会引发致命错误并停止程序。


相关页面

包含关键字

include_once关键字

require_once关键字

在我们的 PHP 包含文件教程中了解有关包含文件的更多信息。


❮ PHP 关键字
0 人点赞过