0

I have a controller in CodeIgniter that does not respond to my requests. When I add a simple function to it function test1 {echo 'test';}, it returns blank response. When I add this function to another controller, it returns 'test' as expected. The syntax for the invalid controller does not differ from a valid one:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class authorized extends CI_Controller 
{
    function index(){echo "test";}

    function __construct()
    {
        parent::__construct();
        //Load Neccessary Models
        $this->load->model('users');
        $this->load->model('manufacturers');
        $this->load->model('suppliers');
        $this->load->model('administrators');
        $this->load->model('banks');
        //End Load Neccessary Models
            define("AUTHORIZENET_API_LOGIN_ID", "");
        define("AUTHORIZENET_TRANSACTION_KEY", "");
        define("AUTHORIZENET_MD5_SETTING", "");
        $this->load->library('authorizenet');       
    }

    function test1(){echo "test";}
}

What can be the reason for its not responding?

Vasily802
  • 1,703
  • 2
  • 18
  • 35

1 Answers1

0

Alright, got it to work by ensuring there is the following order of functions within the controller: function __construct(), then function index(), then my required function test1().

Vasily802
  • 1,703
  • 2
  • 18
  • 35