$name = explode('_', $_POST['ModuleUrlName']); for ($i = 0, $len = count($name); $i < $len; $i++) { if ($i == 0) { $name[$i] = strtolower($name[$i]); } else { $name[$i] = ucfirst(strtolower($name[$i])); } } $_SESSION['ModuleVarName'] = implode('', $name); $_SESSION['ModuleFileName'] = ucfirst($_SESSION['ModuleVarName']); $_SESSION['TableName'] = $_POST['TableName']; $_SESSION['PageNum'] = $_POST['PageNum']; include_once "../admin/class/sql.inc.php"; $mysql = new sql_db($_SESSION['host'], $_SESSION['user'], $_SESSION['pwd'], $_SESSION['dbname']); $sql = "show full fields from `" . $_SESSION['TableName'] . "`"; $rs = $mysql->re_datas($sql); $str = ""; $i = 0; $type_option = '<option value="">不检查</option> <option value="mobile">手机</option> <option value="number">数字</option> <option value="email">邮箱</option> <option value="year">年份</option> <option value="month">月份</option> <option value="day">日期</option> <option value="image">有效图片地址</option> <option value="url">URL地址</option> <option value="postcode">邮编</option> <option value="resource">有效HTTP资源</option> <option value="datatime">日期时间</option> <option value="idcard">身份证</option>
for ($i = 0, $len = count($name); $i < $len; $i++) { if ($i == 0) { $name[$i] = strtolower($name[$i]); } else { $name[$i] = ucfirst(strtolower($name[$i])); } } $_SESSION['ModuleVarName'] = implode('', $name); $_SESSION['ModuleFileName'] = ucfirst($_SESSION['ModuleVarName']); $_SESSION['TableName'] = $_POST['TableName']; $_SESSION['PageNum'] = $_POST['PageNum']; include_once "./class/sql.inc.php"; $mysql = new sql_db($_SESSION['host'], $_SESSION['user'], $_SESSION['pwd'], $_SESSION['dbname']); $mysql->sql_query("SET NAMES UTF8"); $sql = "show full fields from `" . $_SESSION['TableName'] . "`"; $rs = $mysql->re_datas($sql); $sql = "show index from `" . $_SESSION['TableName'] . "`"; $showIndex = $mysql->re_datas($sql); $primaryFieldArr = array(); foreach ($showIndex as $v) { if ($v['Key_name'] == 'PRIMARY') { $primaryFieldArr[] = $v['Column_name']; } } if (!empty($primaryFieldArr)) { $priTd = ' style="display:none;"'; } $str = ""; $i = 0; $type_option = '<option value="">不检查</option> <option value="mobile">手机</option>