阅读量:84
在 PHP 中,您可以使用 getcwd() 函数来获取当前工作目录。以下是如何使用它的示例:
<?php
// 获取当前工作目录
$current_directory = getcwd();
// 输出当前工作目录
echo "当前工作目录: " . $current_directory;
?>
getcwd() 函数返回当前脚本所在的工作目录的完整路径。如果成功,它将返回一个字符串,否则返回 false。