require './application/home/model/'.$className.'.php';
require './application/home/controller/'.$className.'.php';
The teacher wrote the home module directly in the code. If I loaded the custom class from another module, it would cause an error. So I used the MODULE constant declared by the getRequestParams method to replace the module, but the program reported an error, prompting that the MODULE constant was not declared. , is it because the getRequestParams method is a private attribute. So what should I do most correctly? Thank you
You have two options:
Create a path constant: APP_PATH = __DIR__;
Or in the directory you want to load Add: __DIR__ before the file, referencing the absolute path address of the current script as the starting path
In this way, an absolute path to the imported file will be created.