2015年6月12日 星期五

編譯php時指定php.ini位置

在compile php時,可以透過--with-config-file-path 參數來指定位置,可以從原始碼複製php.ini 通常有兩個選擇 一個是開發階段的參數 一個則是生產階段的參數

2015年5月7日 星期四

getConstants

php中反射(ReflectionClass)的語法


如果想要取得物件中取得const的陣列可以使用



    const STATE0 = 'open';
    const STATE1 = 'close';
    const STATE2 = 'run1';
    const STATE3 = 'run2';
    const STATE4 = 'run3';
   
    static function getConstants() {
        $oClass = new ReflectionClass(__CLASS__);
        return $oClass->getConstants();
    }