揮発性のメモ2

http://d.hatena.ne.jp/iww/

abstract function 未実装時の挙動

<?
    spl_autoload_register(function($class){
        $dir = "/opt/hoge/lib";
        $file = str_replace( "_", "/", strtolower($class) );
        @include "$dir/$file.php";
    });

abstruct function を実装し忘れてたクラスを自動ロードさせたとき、includeに@つけてたから当然エラーログに何も吐かずに死ぬので、わけがわからずつらかった。

<?
    spl_autoload_register(function($class){
        $dir = "/opt/hoge/lib";
        $file = str_replace( "_", "/", strtolower($class) );
        include_once "$dir/$file.php";
    });

こうして解決した。あと_onceつけた。