この投稿の最終編集日は 2014-07-01 17:05:54
public function add(){<br /> $this->lottory_record_db=M('Lottery_record');<br /> $this->lottory_db=M('Lottery');<br /> if($_POST['action'] == 'add' ){<br /> $lid = $this->_post('lid');<br /> $wechaid = $this->_post('wechaid');<br /> //$data['sn'] = $this->_post('sncode');<br /> $data['phone'] = $this->_post('tel');<br /> //$data['prize'] = $this->_post('winprize');<br /> $data['wecha_name'] = $this->_post('wxname');<br /> //$data['time'] = time(); <br /> //$data['islottery'] = 1;<br /> //$data['usenums'] = 1; <br /> $rid=intval($this->_post('rid'));<br /> if (!$rid){<br /> $thisRecord=$this->lottory_record_db->where(array('lid'=>$lid,'wecha_id'=>$wechaid,'islottery'=>1))->find();<br /> $rid=$thisRecord['id'];<br /> }<br /> $rollback = $this->lottory_record_db->where(array('lid'=>$lid,'wecha_id'=>$wechaid,'id'=>$rid))->save($data);<br /> $record=$this->lottory_record_db->where(array('id'=>$rid))->find();<br /> echo'{"success":1,"msg":"恭喜!尊敬的<font color=red>'.$data['wecha_name'].'</font>请您保持手机通畅!你的领奖序号:<font color=red>'.$record['sn'].'</font>"}';<br /> exit; <br /> }<br /> }
------解決策----------------------if($_POST['action'] == 'add' ) {
条件 $_POST['action'] == 'add' が成立しないため、echo は実行されません
------解決策----------- -- ------<br /><br />var_dump($_POST['action']);//输出看看值是什么?确定条件成立?<br /><br />
------解決策------ var_dump($_POST['action']);
------解決策---------------------- 出力されるのは単なる JSON 文字列であり、解析するには JS コードが必要です