Php Codeigniter FTP类无错误且未按预期工作

Php Codeigniter FTP类无错误且未按预期工作,php,codeigniter,class,ftp,Php,Codeigniter,Class,Ftp,因此,我尝试使用codeigniter FTP类,并尝试运行以下代码: public function ftp() { echo 'test1'; $config['hostname'] = $this->config->item('ftp_hostname'); $config['username'] = $this->config->item('ftp_username'); $config['password'] = $this-&

因此,我尝试使用codeigniter FTP类,并尝试运行以下代码:

public function ftp()
{
    echo 'test1'; 
    $config['hostname'] = $this->config->item('ftp_hostname');
    $config['username'] = $this->config->item('ftp_username');
    $config['password'] = $this->config->item('ftp_password');
    $config['debug']  = $this->config->item('ftp_debug');

    $this->ftp->connect($config);

    $list = $this->ftp->list_files('/');

    print_r($list);

    $this->ftp->close();

    echo 'test2';       
}
当我访问页面时,我只收到消息“test1”,它没有在页面上列出任何内容。起初我认为这是我的家庭服务器的问题,但是当检查phpinfo()时,它表明ftp是一个可接受的协议,所以肯定不是服务器问题?无论如何,任何帮助都是感激的


非常感谢。

您加载了图书馆FTP吗

$this->load->library('ftp');
如果已经加载了库,请尝试将登录信息写入函数以进行测试

 $config['hostname'] = 'localhost';
 $config['username'] = 'LoginFTP';
 $config['password'] = 'passFTP';
 $config['port']     = 21;
 $config['passive']  = FALSE;
 $config['debug']  = TRUE;
我希望它能帮助你