Php automatically generates class attributes based on the table structure. Php automatically generates class attributes based on the table structure. does php automatically generate class attributes based on the table structure? Php $ table $ _ GET [table]; $ rs $ db-queryAll (SELECTcolumn_name, column_type, column_comment, data _ php automatically generates class attributes based on the table structure
Php automatically generates class attributes based on the table structure
$ Table = $ _ GET ['table'];
$ Rs = $ db-> queryAll ("SELECT column_name, column_type, column_comment, data_type
FROM information_schema. 'column' WHERE 'Table _ name' LIKE '$ table '");
$ Output = '';
Foreach ($ rs as $ r ){
// Turn the underscore into a hump
$ R ['column _ name'] = lcfirst (implode ('', array_map ('ucfirst ', explode ('_', $ r ['column _ name']);
$ Output. = <
/**
* {$ R ['column _ comment']}
* @ Var {$ r ['data _ type']}
*/
Public \ $ {$ r ['column _ name']};
EOF;
}
Echo'
' . $output . '
';
Why php automatically generates class attributes based on the table structure? Php $ table = $ _ GET ['table']; $ rs = $ db-queryAll (SELECT column_name, column_type, column_comment, data _...