That is, I want to define global constants, such as the standalone path of a file and the api excuse. in the future, I will directly call this constant in the controller and model files .. which file should I write constants in? That is, I want to define a global constant,
For example, the single-host path and api excuse of a file. I will call this constant directly in the controller and model files ..
Which file should I write constants in?
Reply content:
That is, I want to define a global constant,
For example, the single-host path and api excuse of a file. I will call this constant directly in the controller and model files ..
Which file should I write constants in?
Portal file
InControllerQuiltThinkPHPYou can writeConst. phpTo define constants and import them to the entry file.
Index. php
# I like to use absolute paths. sometimes, nesting require in relative paths may cause some errors. Require APP_PATH. '../config/const. php ';
It seems like it is defined in the entry file.