ftp_mkdir

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

ftp_mkdir建立新目錄

說明

ftp_mkdir(resource $ftp_stream, string $directory): string

在 FTP 服務(wù)器上,創(chuàng)建指定的目錄 directory。

參數(shù)

ftp_stream

FTP 連接句柄。

directory

要?jiǎng)?chuàng)建的目錄名。

返回值

如果成功返回新建的目錄名,發(fā)生錯(cuò)誤時(shí)返回 false

范例

示例 #1 ftp_mkdir() example

<?php

$dir 
'www';

// set up basic connection
$conn_id ftp_connect($ftp_server);

// login with username and password
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);

// try to create the directory $dir
if (ftp_mkdir($conn_id$dir)) {
 echo 
"successfully created $dir\n";
} else {
 echo 
"There was a problem while creating $dir\n";
}

// close the connection
ftp_close($conn_id);
?>

參見