在php中从ftp服务器下载文件时出错 [英] Getting error to download a file from ftp server in php

查看:90
本文介绍了在php中从ftp服务器下载文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我是php新手。



我复制了一些代码php网站从ftp服务器下载文件。



但是它不能下载...



< b>我尝试了什么:



Hi guys,

I'm new to php.

I copied code from some php website to download a file from ftp server.

But its not downloading...

What I have tried:

<?php

// define some variables
$local_file = 'MyFiles\MAS.docx';
$server_file = $local_file;
$ftp_server = 'ftp.bxxx.com';
$ftp_user_name = 'b7_xxx';
$ftp_user_pass = 'xxxx';
// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

if(!$login_result){
echo 'Not able to connect to the server';}

// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
    echo "Successfully written to $local_file\n";
} else {
    echo "There was a problem\n";
}

// close the connection
ftp_close($conn_id);

?>







任何人都可以查看此代码。< br $> b $ b

plz帮帮我们。



谢谢




can anyone plz check this code.

plz help me guys.

Thanks

推荐答案

local_file ='MyFiles\MAS.docx';
local_file = 'MyFiles\MAS.docx';


server_file =
server_file =


local_file;
local_file;


这篇关于在php中从ftp服务器下载文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆