English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Tutoriel PHP de base

Tutoriel PHP avancé

PHP & MySQL

manuel de référence PHP

Utilisation et exemple de la fonction getcwd() PHP

manuel de référence PHP Directory

La fonction getcwd() obtient le répertoire de travail actuel

Syntaxe

string getcwd ( void );

Définition et utilisation

Il obtient le répertoire de travail actuel.

Paramètres

NuméroParamètres et descriptions
1

void

Aucun paramètre nécessaire

Valeur de retour

Retourne le répertoire de travail actuel avec succès, FALSE en cas d'échec.

Exemple en ligne

Voici l'utilisation de cette fonction, obtenir le répertoire de travail actuel :

<?php
   echo getcwd() . "\n";
   
   getcwd('html');
   
   echo getcwd() . "\n";
?>

Résultat de la sortie :

/home/w3codebox
/home/w3codebox/html