__FILE__是什么意思?
2022-08-30 11:41:17
我有来自Codeigniter的以下代码index.php
我的理解是,
如果 字符串位置在 (在本例中为 CIcore_1_7_1) 为 ,并且如果函数存在且 (?) 不为 ,则分配给 (?)。else 被指定为 替换为 。/
$system_folder
false
realpath
false
$system_folder
/$system_folder
$system_folder
$system_folder
\\
/
问题 1.实路径函数是什么意思?
问题 2.这是什么意思?
@realpath(dirname(__FILE__))
问题 3.我说的对吗?我有什么误解吗?
问题 4.您需要以下哪种情况?
str_replace("\\", "/", $system_folder)
$system_folder = "CIcore_1_7_1";
/*
|---------------------------------------------------------------
| SET THE SERVER PATH
|---------------------------------------------------------------
|
| Let's attempt to determine the full-server path to the "system"
| folder in order to reduce the possibility of path problems.
| Note: We only attempt this if the user hasn't specified a
| full server path.
|
*/
if (strpos($system_folder, '/') === FALSE)
{
if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
{
$system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
}
}
else
{
// Swap directory separators to Unix style for consistency
$system_folder = str_replace("\\", "/", $system_folder);
}