PHP 包含目录:第一次使用包含

PHP include directoy: first time using the include

我想将 bd.php 添加到 Cidadao 文件夹中的文件中。像这样:

我试过这段代码:

<?php include 'bd.php';?>

总线无法正常工作。

这是 code.

试试这个:

<?php include '../bd.php';?>

要在 php 中包含任何文件,您可以使用 include、require_once 和 require。
并包含一个前向目录文件使用 include'dir1/dir2/filename.php'。对于后向目录文件,使用 include'../../filename.php'
请记住,对于 include,您可以向前和向后移动 n 个目录。