Welcome Guest, Not a member yet? Register   Sign In
FTP Class - Usage first time at codeigniter how to?
#1

Hi,
This is my first time at php MVC.
I need to use an class from system. I will be reading files from a ftp server.
At tutorial of codeigniter.com web site. There is some instructions on how to use the FTP capability.
<?php

      namespace App\Controllers;

      use App\Controllers\BaseController;

      class FtpController extends BaseController{

      public function listFtp(){

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

        $config['hostname'] = 'ftp.example.com';
        $config['username'] = 'your-username';
        $config['password'] = 'your-password';
        $config['debug']        = TRUE;

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

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

        print_r($list);

        $this->ftp->close();

   }
}
This is my controller called with the listFtp function. This function is described at my route.php file.
When I run the controller I got an error which the codeigniter could not load the library.
I am using the structure wrong?
How can I use the Controller on a function way?
What is the right use of this class and app controller?
At my function listFtp does not work at the first line.   $this->load->library('ftp');
Reply




Theme © iAndrew 2016 - Forum software by © MyBB