【发布时间】:2021-11-24 15:17:01
【问题描述】:
我想使用已经在 CodeIgniter 中的 FTP 类从 FTP 服务器下载一些文件,但是我收到错误 ftp_get() failed to open stream : permission denied 当我调用我的代码时。有人可以帮帮我吗?
这是我的代码
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class C_FTP extends CI_Controller
{
public function openfile($fileName)
{
$this->load->library('ftp');
$config['hostname'] = 'ftp_host';
$config['username'] = 'ftp_username';
$config['password'] = 'ftp_password';
$config['port'] = 'ftp_port';
$config['debug'] = FALSE;
$config['passive'] = FALSE;
$this->ftp->connect($config);
$this->ftp->download('path/to/folder/', 'local/path', 'auto');
$this->ftp->close();
}}
?>
我的 ci 版本是:2.2.0
【问题讨论】:
-
收到 500 错误时需要做的第一件事是检查 PHP 错误日志,然后才能找出真正的错误信息。
-
提前谢谢你,现在我找到了真正的错误,错误是
failed to open stream: permission denied,我已经按照link的步骤进行操作,但不起作用。我得到了差异错误:The system cannot find the file specified当我将本地路径更改为/tmp时,我认为这个文件夹只存在于 linux 中,但我使用的是 windows
标签: php codeigniter ftp codeigniter-3 codeigniter-2