建立新目錄

ftp_mkdir

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

ftp_mkdir — 建立新目錄

說明

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

在 FTP 伺服器上,建立指定的目錄 directory。

參數

ftp_stream

FTP 連線控制代碼。

directory

要建立的目錄名。

返回值

如果成功返回新建的目錄名,發生錯誤時返回 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);
?>

參見

Leave a Reply

Your email address will not be published. Required fields are marked *