【问题标题】:Codeigniter FTP Class no errors and not working as intendedCodeigniter FTP 类没有错误并且没有按预期工作
【发布时间】:2014-03-25 17:25:38
【问题描述】:

所以我正在尝试使用 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 是一个可接受的协议,所以它肯定不是服务器问题吗?无论如何,任何帮助表示赞赏。

非常感谢。

【问题讨论】:

    标签: php codeigniter class ftp


    【解决方案1】:

    你加载文件库 FTP 了吗?

    $this->load->library('ftp');
    

    如果你已经加载了库,尝试将登录信息写入函数进行测试。

     $config['hostname'] = 'localhost';
     $config['username'] = 'LoginFTP';
     $config['password'] = 'passFTP';
     $config['port']     = 21;
     $config['passive']  = FALSE;
     $config['debug']  = TRUE;
    

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-15
      • 2012-04-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多