0
何时会执行下面的else语句?如果$ system_path无效,原因是它将转到else语句。然而,在这种情况下,else语句似乎没有意义。什么是else语句代表codeigniter index.php中的第196行
https://github.com/bcit-ci/CodeIgniter/blob/develop/index.php线196
if (($_temp = realpath($system_path)) !== FALSE)
{
$system_path = $_temp.DIRECTORY_SEPARATOR;
}
else
{
// Ensure there's a trailing slash
$system_path = strtr(
rtrim($system_path, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
).DIRECTORY_SEPARATOR;
}
是的,我知道这一点。但正如我所说,如果$ system_path不存在。 else语句似乎没有意义。我猜这在其他块代码中必须有其他含义。 –
我修改了我的答案。它有帮助吗? – DFriend
感谢您的灵感。我发现当'$ system_path'写成windows风格时,例如'$ system_path =“。\\ some_path \\ system”',它只能在windows环境下工作。 else语句代码'$ system_path = strtr( rtrim($ system_path,'/ \\'), '/ \\', DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR ).DIRECTORY_SEPARATOR;'用于解决平台问题。 –