A good php code, whether in windows or linux, different versions of php, can correctly output the results, is a good code. It is not easy to do things that are easy to say. in many cases, writing code is function-oriented. in the current environment, it is necessary to see the results immediately, basically... "/> <scripttype =" text/javascript "src =" http: // w a good php code, whether in windows or linux, different versions of php, it is a good code to output results correctly.
It is not easy to do things that are easy to say. in many cases, writing code is function-oriented. in the current environment, it is necessary to see the results immediately, basically how convenient it is.
However, in order to write a good code and reduce debugging time in the future, you should consider whether you can adapt to the difficulties you can think of when writing every code. every time you solve one problem, it will take a long time, your code is scalable.
The relative path is for the folder where the current code file is located.
The absolute path is relative to the root folder.
When the code depends on other files, you need to unify the code inclusion path.
Files cannot be found during code execution, most of which are because no paths are defined.
I recommend you write absolute paths to write programs. Once the relative paths are moved, the files to be included may not be found.
Php functions and constants used
Dirname
_ FILE __
DIRECTORY_SEPARATOR
It is recommended to write an initialization file initialize. php.
// Define the core paths // Define them as absolute paths to make sure that require_once works as expected // DIRECTORY_SEPARATOR is a PHP pre-defined constant // (\ For Windows,/for Unix) Defined ('Ds ')? Null: define ('Ds', DIRECTORY_SEPARATOR ); Defined ('site _ root ')? Null: define ('site _ root', dirname (_ FILE __)); Defined ('Lib _ path ')? Null: define ('Lib _ path', SITE_ROOT.DS. 'include '); // Load config file first Require_once (LIB_PATH.DS. 'config. php '); // Load basic functions next so that everything after can use them Require_once (LIB_PATH.DS. 'functions. php '); // Load core objects Require_once (LIB_PATH.DS. 'session. php '); Require_once (LIB_PATH.DS. 'database. php '); // Load database-related classes Require_once (LIB_PATH.DS. 'user. php '); |