CakePHPの定数
今私は仕事でCakePHPを使用しております。
CakePHPでは、システムで使う定数を bootstrap.php あたりで define します。
define('foo', 'bar');
とか。でもこれだと array 、つまり配列が使えません。
メールを複数に飛ばすときとか、foreachでまわして取り出したいなあと
思ったりします。
で、これを、
class MY { public static $DB = 'default'; }
などして、
class AppModel extends Model { function __construct($id = false, $table = null, $ds = null) { $this->useDbConfig = MY::$DB; parent::__construct($id, $table, $ds); } }
とかなんとかするといいのかなあと思いました。
参考