PHP ftp_exec() 函数

ການອະທິບາຍ ແລະການນຳໃຊ້

ftp_exec() 函数ສະໜອງຄຳສັ່ງທີ່ຈະດຳເນີນຄອບເຂົາຫຼືຄຳສັ່ງໃນ FTP 服务器.

ຖ້າສຳເລັດ (FTP 服务器发送响应代码 200), ກັບຄືນ true, ບໍ່ສຳເລັດກັບ false.

ສັບສັນ

ftp_exec(ftp_connection,command)
ສະຫຼະ ອະທິບາຍ
ftp_connection ສະຫຼະ. ກໍານົດ FTP 连接ທີ່ຈະນຳໃຊ້ (FTP 连接标识符).
command ສະຫຼະ. ກໍານົດຄຳສັ່ງທີ່ຈະສົ່ງໄປຫາທີ່ຫາຍ.

ອະທິບາຍ

ຫົວຂໍ້ຫົວຂໍ້ການສົ່ງຄຳສັ່ງ SITE EXEC command ຫາ FTP 服务器.

ຄຳຂໍ້ສັບສັນແລະຄວາມຄິດ

ກັບ ຫົວຂໍ້ຫົວຂໍ້ ftp_raw() ທີ່ຕ່າງກັນ, ftp_exec() ພຽງແຕ່ສາມາດສົ່ງຄຳສັ່ງໃຫ້ FTP 服务器ຫຼັງຈາກການເຂົ້າເຖິງ FTP 服务器.

ຕົວຢ່າງ

<?php
$command = "ls-al > test.txt";
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
if (ftp_exec($conn,$command))
  {
  echo "Command executed successfully";
  } 
else
  {
  echo "Execution of command failed";
  }
ftp_close($conn);
?>