質問

くださいをうまく使いこなせる方法spl_autoload_register()とCodeigniter?いこのためIm用Codeigniter他の枠組みも変化.

見たよう

PHP spl_autoload_register

あまりないと思いますか対象にCodeIgniter変化.Im新OOPとCodeigniter.おみやげをたくさん!

上記のリンクはこの:

function autoload_services($class_name){
    $file = 'services/' . $class_name. '.php';
    if (file_exists($file)){
        require_once($file);
    }
}

function autoload_vos($class_name){
    $file = 'vos/' . $class_name. '.php';
    if (file_exists($file)){
        require_once($file);
    }
}

function autoload_printers($class_name){
    $file = 'printers' . $class_name. '.php';
    if (file_exists($file)){
        require_once($file);
    }
}

spl_autoload_register('autoload_services');
spl_autoload_register('autoload_vos');
spl_autoload_register('autoload_printers');
役に立ちましたか?

解決

感謝 http://codeigniter.com/forums/viewthread/73804/#366081 一部のビットの情報からCI民俗いtwitterのフォローいたem): エリック-ュータシミュレーション, ダンHorrigan, フィル-チョウザメZack Kitzmiller, 私は見つかります。だCodeIgniter n00bのようにできているかの確認を行います。場合のようにこの操作はしまいました。

削除してしまいましたinit.php やconfig.phpその詰まった以下のものCI config.php (私もautoloadingからカスタム図書館というmylibrary).

function multi_auto_require($class) {
if(stripos($class, 'CI') === FALSE && stripos($class, 'PEAR') === FALSE) {
    foreach (array('flourish', 'mylibrary') as $folder){
        if (is_file(APPPATH."../auxengines/{$folder}/{$class}.php")){
            include_once APPPATH."../auxengines/{$folder}/{$class}.php";
        }
    }
}
}

spl_autoload_register('multi_auto_require');

作品を見事に.おかげさい。

他のヒント

おおぅ、今後を見る 事前の質問 だから)...い問題がある2つの定義 __autoload 機能との結果を解析エラー)...

修理してください、名前の変更の一つになっても、他のものその直後の定義通 spl_autoload_register('yournewfunctionname');...

するすべてではありますので、いつでも理解している問題...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top