0

ファイルの下に拡張するか、autoload.php でオートロードするだけで、http 500 と空の出力が得られますMYControllerInterface.php は application/libraries の下にあります。

ディレクトリ全体を (再帰的に) 0777 に chmod しました。ルート ディレクトリに RewriteEngine をオンおよびオフにして .htaccess を作成しました。

MYcontrollerInterface の { から } までのすべてをコメントアウトしました...

エンディングを削除してみました ?>

mod_rewrite が php config で有効になっていることを確認しました...これはとても不思議です!

<?php 
class MYcontrollerInterface extends CI_Controller {
    public function __construct() {
        parent::__construct();
        //$this->load->helper('url');
    }   

    function build_page($main_content_view, $data) {
        /*
        $this->load->view('header', $data);    
        //$this->load->view('content', $data);      
        //$this->load->view($main_content_view, $data, true);
        $this->load->view('footer', $data);   
        */      
        echo 'apa';
    }   
}

/* End of file MycontrollerInterface.php */
/* Location: ./application/controllers/MYcontrollerInterface.php */
?>

アプリケーション/ログ/ログ-2012-04-12.php:

DEBUG - 2012-04-12 13:21:22 --> Config Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Hooks Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Utf8 Class Initialized
DEBUG - 2012-04-12 13:21:22 --> UTF-8 Support Enabled
DEBUG - 2012-04-12 13:21:22 --> URI Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Router Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Output Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Security Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Input Class Initialized

以下は繰り返します:

DEBUG - 2012-04-12 13:21:22 --> Global POST and COOKIE data sanitized
DEBUG - 2012-04-12 13:21:22 --> Language Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Loader Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Controller Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Final output sent to browser
DEBUG - 2012-04-12 13:21:22 --> Total execution time: 0.0320
DEBUG - 2012-04-12 13:21:38 --> Config Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Hooks Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Utf8 Class Initialized
DEBUG - 2012-04-12 13:21:38 --> UTF-8 Support Enabled
DEBUG - 2012-04-12 13:21:38 --> URI Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Router Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Output Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Security Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Input Class Initialized
4

2 に答える 2

1

コントローラー (コア クラス) を拡張する場合は、/application/core に配置する必要があります。

プレフィックスも確認してください。CI2 標準は MY_ です (109 行目の $config['subclass_prefix'] を確認してください)。

UPDATE拡張コントローラーは、MY_Controller と呼ばれる必要があります (ローダー クラスに従って)。

その後、次のように使用します...

class foo extends MY_Controller {
    function __construct() {
        parent::construct();
    }
}
于 2012-04-12T11:43:08.310 に答える
-1

このファイルをsystem/librariesフォルダーに入れて、拡張してみてください。

于 2012-04-12T11:38:26.880 に答える