在所有的語言中,所有路徑的引用:
1。 /index/index.jpg 這個路徑就是相對於當前文件夾中的index文件夾下的index.jpg文件。
2。 一般關於php文件中的,
當你開始一個php 項目的時候如果要引用本項目中已經有的文件的時候文件目錄要使用絕對路徑:不過一般在 index.php 中
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../'));
//
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
include_once APPLICATION_PATH."/Maged/Model.php";
一般都是使用這樣的形式進行引用文件: