首先定义全部的数据,命名为data.php:
<?php
$data = [
[
"text" =>"姓 名:",
"tag" =>"input",
"attr" =>['type'=>'text','name'=>'username']
],
[
"text" =>"密 码:",
"tag" =>"input",
"attr" =>['type'=>'password','name'=>'pwd']
],
[
"text" =>"邮 箱:",
"tag" =>"input",
"attr" =>['type'=>'text','name'=>'email']
],
[
"text" =>"电 话:",
"tag" =>"input",
"attr" =>['type'=>'text','name'=>'tel']
],
[
'tag' => 'input',
'text' => '性 别:',
'attr' => ['type' => 'radio', 'name' => 'gender'],
'option' => ['m' => '男', 'w' => '女']
],
[
'tag' => 'select',
'text' => '住 址:',
'attr' => ['name' => 'area'],
'option' => ['' => '--请选择--', 'BJ' => '北京', 'SH' => '上海', 'SZ' => '深圳',]
],