array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'function.getcwd.php', 1 => 'getcwd', 2 => 'Gets the current working directory', ), 'up' => array ( 0 => 'ref.dir.php', 1 => 'Функції для роботи з теками', ), 'prev' => array ( 0 => 'function.dir.php', 1 => 'dir', ), 'next' => array ( 0 => 'function.opendir.php', 1 => 'opendir', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/dir/functions/getcwd.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
getcwd — Gets the current working directory
У цієї функції немає параметрів.
Returns the current working directory on success, or false on
failure.
On some Unix variants, getcwd() will return
false if any one of the parent directories does not have the
readable or search mode set, even if the current directory
does. See chmod() for more information on
modes and permissions.
Приклад #1 getcwd() example
<?php
// current directory
echo getcwd() . "\n";
chdir('cvs');
// current directory
echo getcwd() . "\n";
?>Поданий вище приклад виведе щось схоже на:
/home/didou /home/didou/cvs
If the PHP interpreter has been built with ZTS (Zend Thread Safety) enabled, the current working directory returned by getcwd() may be different from that returned by operating system interfaces. External libraries (invoked through FFI) which depend on the current working directory will be affected.