路徑輔助函數(shù)
路徑輔助函可以讓您使用服務器端的文件路徑來工作。
載入輔助函數(shù)
使用如下代碼來載入路徑輔助函數(shù):
$this->load->helper('path');
可用函數(shù):
set_realpath()
檢查路徑是否有效。此函數(shù)會返回一個沒有符號連接的服務器路徑或相對目錄結構,函數(shù)中的第二個參數(shù)為TRUE時,如果程序無法確定指定的路徑,則會觸發(fā)一個錯誤。
$directory = '/etc/passwd';
echo set_realpath($directory);
// returns "/etc/passwd"
$non_existent_directory = '/path/to/nowhere';
echo set_realpath($non_existent_directory, TRUE);
// returns an error, as the path could not be resolved
echo set_realpath($non_existent_directory, FALSE);
// returns "/path/to/nowhere"
?
?
翻譯貢獻者:
Hex, shishirui
最后修改: 2009-02-21 18:26:01