That is, I want to define some global constants,
For example, the stand-alone path of a certain file, api interface, etc., in the future I can just call this constant directly in the controller and model class files...
Excuse me, which file should I write the constants in?
That is, I want to define some global constants,
For example, the stand-alone path of a certain file, api interface, etc., in the future I can just call this constant directly in the controller and model class files...
Excuse me, which file should I write the constants in?
Entry file
Just before Controller
is called by ThinkPHP
, you can write a const.php
to specifically define some constants and import them into the entry file.
index.php
<code>#我喜欢用绝对路径,有时候相对路径嵌套require可能会引起一些错误。 require APP_PATH.'../config/const.php';</code>
It seems that it can be defined in the entry file