我制作了一个代码来生成 11 位随机数,我想将所有数字保存在数据库中
admin_create_epin.ctp(查看)
<tr>
Add E-pin:(No of E-Pin)
<td><?php echo $this->Form->input('e_pin',array('label'=>false));?></td>
</tr>
epins_controller.php
public function admin_create_epin(){
$limit = $this->data['Epin']['e_pin'];
for($i=0;$i<$limit;$i++)
{
$random = substr(number_format(time() * rand(),0,'',''),0,11)."<br/>";
$this->data['Epin']['e_pin'] = $random;
//pr($this->data); it's show all random number
$this->Epin->save($this->data); // i have problem only here it's save only last random number
$this->Session->setFlash("Epin has been added");
$this->Redirect(array('action'=>'admin_create_epin'));
}
}
问题:代码生成所有随机数,但我的代码有问题,仅插入最后一个随机数而不是全部,我想插入所有随机数
谢谢