TUTORIAL后端与 Web 服务FETCHED

PHP getcwd() 函数

PHP getcwd() 函数 PHP Directory 参考手册 实例 获取当前工作目录: <?phpecho getcwd()?> 结果: /home/php 定义和用法 getchwd() 函数返回当前工作目录。 语法 getcwd(); 技术细节 返回值: 成功则返回当前工作目录。失败则返回 FALSE。 PHP 版本: 4.0+ PHP Directo..

更新于 2026/7/16

教程详情页默认 noindex。

PHP getcwd() 函数

PHP Directory PHP Directory 参考手册

实例

获取当前工作目录:

<?php
echo getcwd()
?>

结果:

/home/php


定义和用法

getchwd() 函数返回当前工作目录。


语法

getcwd();

技术细节

返回值: 成功则返回当前工作目录。失败则返回 FALSE。
PHP 版本: 4.0+


PHP Directory PHP Directory 参考手册