<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class FileDownloadController extends CI_Controller{
public function index()
{
$this->load->helper('download');
$data = 'Here is some text!';
$name = 'mytext.txt';
force_download($name, $data);
}
}
We creating home controller that load a view as home.
×
Create Home Controller
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class HomeController extends CI_Controller{
public function index()
{
$this->load->view('home');
}
}
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Ip_Address_Method_Controller extends CI_Controller
{
public function index()
{
echo $this->input->ip_address();
}
}