您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php根据表结构自动生成类属性

2024/3/15 7:40:58发布32次查看
'set names \'utf8\'')); $rs = $conn->query(select column_name,column_type,column_comment,data_type from information_schema.`columns` where `table_name` like '$table' and `table_schema` like '$schema');$output = '';foreach ($rs as $r) { $r['column_name'] = $r['column_name']; // 下划线转驼峰 // $r['column_name'] = lcfirst(implode('', array_map('ucfirst', explode('_', $r['column_name'])))); $output .=\n/** * {$r['column_comment']} * @var {$r['data_type']} {$r['column_type']} */public \${$r['column_name']}; \n eof;}echo '' . $output . '
';
复制代码
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product