I have the following code from Codeigniter index.php
My understanding is that,
If /
of string position in $system_folder
(in this case CIcore_1_7_1) is false
,
and if realpath
function exists AND (?) is not false
,
$system_folder
is assigned to (?) /$system_folder
.
else $system_folder
is assigned to $system_folder
with replacing \
with /
.
Q1. What does realpath function means?
Q2. What does this mean?
@realpath(dirname(__FILE__))
Q3. Am I right? Do I have any misunderstanding?
Q4. What kind of situation do you need the following?
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);
}
question from:
https://stackoverflow.com/questions/1506459/what-does-file-mean 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…