Home  >  Article  >  Backend Development  >  这段代码中echo如何不执行呢,高手给支个招

这段代码中echo如何不执行呢,高手给支个招

WBOY
WBOYOriginal
2016-06-13 12:01:311059browse

这段代码中echo怎么不执行呢,高手给支个招

本帖最后由 xuzuning 于 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 代码去解析呀
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn