mysql数据库区分字段大小写(laravel ORM)

时间:2021-09-10 04:46:17
'mysql' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST', ''),
            'database'  => env('DB_DATABASE', ''),
            'username'  => env('DB_USERNAME', ''),
            'password'  => env('DB_PASSWORD', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
            'options'   => [
			   //强制列名为指定的大小写
               PDO::ATTR_CASE => PDO::CASE_LOWER,
			  
			   //(在所有驱动中都可用,不仅限于Oracle): 转换 NULL 和空字符串
               PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
			   
			   //提取的时候将数值转换为字符串
               PDO::ATTR_STRINGIFY_FETCHES => true,
			   
			   //支持预处理
               PDO::ATTR_EMULATE_PREPARES => true,
           ],
        ],