路徑輔助函數(shù)
路徑輔助函可以讓您使用服務(wù)器端的文件路徑來工作。
載入輔助函數(shù)
使用如下代碼來載入路徑輔助函數(shù):
$this->load->helper('path');
可用函數(shù):
set_realpath()
檢查路徑是否有效。此函數(shù)會(huì)返回一個(gè)沒有符號(hào)連接的服務(wù)器路徑或相對目錄結(jié)構(gòu),函數(shù)中的第二個(gè)參數(shù)為TRUE時(shí),如果程序無法確定指定的路徑,則會(huì)觸發(fā)一個(gè)錯(cuò)誤。
$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"
?
?
翻譯貢獻(xiàn)者:
Hex, shishirui
最后修改: 2009-02-21 18:26:01