當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


PHP getcwd()用法及代碼示例

PHP getcwd() 函數

getcwd 的全稱是“Get Current Working Directory”,函數getcwd() 用於獲取當前工作目錄的名稱,它不接受任何參數並返回當前工作目錄。

用法:

    getcwd();

參數:

  • 它不接受任何參數。

返回值:

如果函數執行成功則返回當前工作目錄,如果函數執行失敗則返回"FALSE"。

示例:獲取當前工作目錄名稱的PHP代碼

<?php
$result = getcwd();
echo "current working directory is:".$result."<br/>";
?>

輸出

current working directory is:/home


相關用法


注:本文由純淨天空篩選整理自 PHP getcwd() function with example。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。