Skip to content

PHP包含文件 #13

@suhao

Description

@suhao

在 PHP 中,您可以在服务器执行 PHP 文件之前在该文件中插入一个文件的内容。 include 和 require 语句用于在执行流中插入写在其他文件中的有用的代码。

PHP include 和 require 语句

  • require 生成一个致命错误(E_COMPILE_ERROR),在错误发生后脚本会停止执行
  • include 生成一个警告(E_WARNING),在错误发生后脚本会继续执行

在框架、CMS 或者复杂的 PHP 应用程序编程中,请始终使用 require 向执行流引用关键文件。在某个关键文件意外丢失的情况下,这有助于提高应用程序的安全性和完整性。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions