/************************************** 测试 *********************************** $ftp = new ftp('222.13.67.42',21,'hlj','123456'); // 打开FTP连接 $ftp->up_file('aa.wav','test/13548957217/bb.wav'); // 上传文件 //$ftp->move_file('aaa/aaa.php','aaa.php'); // 移动文件 //$ftp->copy_file('aaa.php','aaa/aaa.php'); // 复制文件 //$ftp->del_file('aaa.php'); // 删除文件 $ftp->close(); // 关闭FTP连接 //******************************************************************************/
3. PHP用FTP函数创建目录
<?php // create directory through FTP connection function FtpMkdir($path, $newDir) { $server='ftp.yourserver.com'; // ftp server $connection = ftp_connect($server); // connection // login to ftp server $user = "me"; $pass = "password"; $result = ftp_login($connection, $user, $pass); // check if connection was made if ((!$connection) || (!$result)) { return false; exit(); } else { ftp_chdir($connection, $path); // go to destination dir if(ftp_mkdir($connection,$newDir)) { // create directory return $newDir; } else { return false; } ftp_close($conn_id); // close connection } } ?>