我知道自动加载机制,但是我不想使用它(_autoload()或spl_autoload_register),我只想简单地编写php函数文件。但这是行不通的。
系统:
php 7.3.x
nginx : 1.15.x
文件:
| - index.php
| - Code
|- Code.php
|- Medoo.php
|- HelperDateTime.php
.....
Code.php:
class Code{
public function Run(){
include "./Medoo.php";
include "./HelperDateTime.php";
....
}
}
index.php:
require 'Code.php';
Code::Run();
// medoo not work
$database = new medoo();
print_r($database);
php初学者,请告知:)
答案 0 :(得分:0)
Index.php
<?php
include "Code/Medoo.php";
include "Code/HelperDateTime.php";
require 'Code.php';
Code::Run();
// medoo will work
$database = new medoo();
print_r($database);
?>