public function insert() {
$data = I('post.');
$shiqu = $data['city_shi'];
$coun = count($shiqu);
if ($this->DB->create($data)) {
if ($coun == 0) {
$this->error('请选择城市!');
} elseif ($coun == 1) {
$this->DB->city_shi = $shiqu[0];
if (false !== $this->DB->add()) {
$this->success('提交成功!');
} else {
$this->error('提交失败!');
}
} else {
foreach ($shiqu as $k => $v) {
$this->DB->city_shi = $v;
$this->DB->add();
}
}
} else {
$this->error($this->DB->getError());
}
}我这样处理,没有勾选提示用户 请选择城市勾选一个,写入正常
勾选二个以上 就出现空白!
大侠路过还望指点一二
最佳答案