2014-05-09 44 views
0

我在CodeIgniter中有一個控制器不響應我的請求。當我爲它添加一個簡單函數function test1 {echo 'test';},它返回空白響應。當我將此函數添加到另一個控制器時,它會按預期返回「測試」。無效控制器的語法與有效控制器的語法沒有區別:Codeigniter控制器不返回請求的功能

<?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";} 
} 

什麼原因導致其無響應?

回答

0

好的,通過確保控制器中有以下順序的函數來實現它:函數__construct(),函數index(),然後是我需要的函數test1()。