我从笨下面的代码index.php
__FILE__是什么意思?
我的理解是,
如果在$system_folder
字符串的位置(在这种情况下CIcore_1_7_1)为false
, 如果realpath
函数存在和/
(?)是不是false
, $system_folder
被分配给(?)/$system_folder
。 否则$system_folder
被分配给$system_folder
,用/
代替\\
。
Q1。 realpath函数的含义是什么? Q2302。这是什么意思?
@realpath(dirname(__FILE__))
Q3。我对吗?我有任何误解吗?
Q4。你需要什么样的情况下面?
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);
}
为什么有两个\ s,而不是一个\? – shin 2009-10-02 10:03:04
因为\是转义字符 - 在一个字符串中加上一个引号,所以你可以使用“this is \”一个引号“,所以要放一个反斜线,你需要两个:”这是一个反斜杠“ – Greg 2009-10-02 10:06:02