Chinaunix

标题: 在php中使用ftp函数问题 [打印本页]

作者: dnetworker    时间: 2004-07-29 15:32
标题: 在php中使用ftp函数问题
我现在准备用ftp函数实现对远程文件的访问。php文件中加入:
<?php
    $servername="xxxx";
    $usrname="xxxx";
    $password="xxxxxxx";
    $path="xxxxxx";
    $conn_id=ftp_connect($servername);
    $login_result = ftp_login($conn_id, $username, $password);
    if ((!$conn_id) || (!$login_result)) {
       echo "FTP connection has failed!";
       echo "Attempted to connect to $ftp_server for user $ftp_user_name";
       exit;
   } else {
       echo "Connected to $ftp_server, for user $ftp_user_name";
       ftp_delete($path);
   }
?>;
始终不能成功。是否还需要什么配置,好象要在安装php时加--enable -ftp
请指教。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2