PHP 8.3.4 Released!

ftp_pwd

(PHP 4, PHP 5, PHP 7, PHP 8)

ftp_pwdRetorna o nome do diretório atual

Descrição

ftp_pwd(FTP\Connection $ftp): string|false

Parâmetros

ftp

Uma instância de FTP\Connection.

Valor Retornado

Retorna o nome do diretório atual ou false em caso de erro.

Registro de Alterações

Versão Descrição
8.1.0 O parâmetro ftp agora espera uma instância de FTP\Connection; anteriormente, um resource era esperado.

Exemplos

Exemplo #1 Exemplo de ftp_pwd()

<?php

// define uma conexão básica
$ftp = ftp_connect($ftp_server);

// login com usuário e senha
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);

// muda o diretório para public_html
ftp_chdir($ftp, 'public_html');

// mostra o diretório atual
echo ftp_pwd($ftp); // /public_html

// fecha a conexão
ftp_close($ftp);
?>

Veja Também

add a note

User Contributed Notes 1 note

up
5
mike dot hall at opencube dot co dot uk
22 years ago
This function doesn't always go to the remote server for the PWD. Once called the PWD is cached, and until PHP has a reason to believe the directory has changed any call to ftp_pwd() will return from the cache, even if the remote server has gone away.
To Top