php使用ftp函数创建目录(生成静态)
-
原创
-
2016-07-25 09:04:40
1075浏览
/** - * desc:create directory through FTP connection
- * link:bbs.it-home.org
- * date:2013/02/24
- */
- 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
- }
- }
- ?>
复制代码 |
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。