PHP - Fonction getcwd ()

Syntaxe

string getcwd ( void );

Définition et utilisation

Il obtient le répertoire de travail actuel.

Paramètres

Sr. Non Paramètre et description
1

void

N / A

Valeur de retour

Il renvoie le répertoire de travail actuel en cas de succès ou FALSE en cas d'échec.

Exemple

Voici l'utilisation de cette fonction -

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

Cela produira le résultat suivant -

/home/tutorialspoint
/home/tutorialspoint/html