db_mysqli::getFields PHP Méthode

getFields() public méthode

取得数据表的字段信息
public getFields ( $tableName ) : array
Résultat array
    public function getFields($tableName)
    {
        $result = $this->query('SHOW COLUMNS FROM ' . $this->parseKey($tableName));
        $info = array();
        if ($result) {
            foreach ($result as $key => $val) {
                $info[$val['Field']] = array('name' => $val['Field'], 'type' => $val['Type'], 'notnull' => (bool) ($val['Null'] === ''), 'default' => $val['Default'], 'primary' => strtolower($val['Key']) == 'pri', 'autoinc' => strtolower($val['Extra']) == 'auto_increment');
            }
        }
        return $info;
    }