userAutoLoad method cannot use MODULE constants
碎天
碎天 2019-02-19 00:06:41
0
2
963

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


碎天
碎天

reply all (1)
Peter-Zhu

You have two options:

  1. Create a path constant: APP_PATH = __DIR__;

  2. 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.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!