?? Abstract: When learning thinkphp source code, it involves multiple files nested problems, then the file path should be how to determine? will be recorded here.
First of all
?? This article is the main reference. He spoke in great detail, but for the pragmatist, it is easier for me to use so many things.
Write in front: All the paths I have here (which are the absolute path representation of the server) are described below:
- Apache Server root directory:?/home/pi/www/
- Project file root directory:??? /home/pi/www/mvctest/2test/
- Project entry file:???? /home/pi/www/mvctest/2test/index.php
- The next file to include:? /home/pi/www/mvctest/2test/framework/framework.php
- Then nest the included files:?? /home/pi/www/mvctest/2test/framework/common/function.php
Relative path
?? The relative path starts with a./Start (and also: /used very rarely), meaning that the current file is located in the directory as a reference directory, but there is a misunderstanding, if nested contains, there will be problems.
?? The problem is that PHP's explanation for the include require file is this:
require)语句会获取指定文件中存在的所有文本/代码/标记,并复制到使用 include 语句的文件中。
?? This means that when index.php is called, the following two referenced file contents are copied to the index.php file.
So: When the nested file also needs include/require operation, using relative path, then, the reference path is actually the directory of the portal file, not the directory where the current file is located.
Absolute path
?? An absolute path is an absolute path using the server (machine) file system, which is not related to the root directory of the Apache server.
?? The use of absolute paths is simple, it is not easy to confuse errors, the following provides a technique.
使用dirname(__FILE__);函数可以获取当前文件所在的绝对路径,然后就可以不用管当前文件的入口文件在哪,使用获取到的路径,再拼接一下字符串就OK了。
Path not determined
?? That is, not before the path.
?? This kind of thing is not to be considered, using the above two formal methods is enough, do not care about this thing.
<完>
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the PHP require and include path issues, including the require aspects of the content, I hope that the PHP tutorial interested in a friend to help.