« ftp_quit
ftp_rawlist »

ftp_raw

(PHP 5, PHP 7, PHP 8)

ftp_raw — FTP サーバーに任意のコマンドを送信する

説明

function ftp_raw(FTP\Connection $ftp, string $command): ?array

任意の command を FTP サーバーに送信します。

パラメータ

ftp

FTP\Connection クラスのインスタンス

command

実行したいコマンド。

戻り値

サーバーからの応答を文字列の配列で返します。 失敗した場合は null を返します。 結果の文字列に対して、何の処理も行いません。また、 ftp_raw() はそのコマンドが成功したのかどうかを 判断できません。

変更履歴

バージョン 説明
8.1.0 引数 ftp は、FTP\Connection のインスタンスを期待するようになりました。 これより前のバージョンでは、resource を期待していました。

例

例1 ftp_raw() を用いて FTP サーバーに手動でログインする

<?php
$ftp = ftp_connect("ftp.example.com");

/* ftp_login($ftp, "joeblow", "secret");
   を実行するのと同じ意味  */
ftp_raw($ftp, "USER joeblow");
ftp_raw($ftp, "PASS secret");
?>

参考

  • ftp_exec() - FTP サーバー上でのコマンドの実行をリクエストする

関連キーワード:
サーバー   任意   送信   Connection   command   インスタンス   期待   joeblow   secret   quit   rawlist   応答   成功   判断   履歴   resource   手動   ログイン   connect   example   login   意味   参考   exec   リクエスト
関連する関数・ページ:
function.ftp-exec   function.ftp-site   function.pg-put-copy-data   function.pg-jit   book.ftp   ref.ftp