ホームページ  >  記事  >  バックエンド開発  >  このコードでエコーが実行されないのはなぜですか? 専門家からアドバイスをいただけますか?

このコードでエコーが実行されないのはなぜですか? 専門家からアドバイスをいただけますか?

WBOY
WBOYオリジナル
2016-06-23 13:54:311207ブラウズ

そうですか


ディスカッションへの返信 (解決策)

if($_POST['action'] == 'add' ){
条件 $_POST['action'] == 'add' は true ではありません、したがって、echo は実行されません

public function add(){		$this->lottory_record_db=M('Lottery_record');		$this->lottory_db=M('Lottery');		 if($_POST['action'] ==  'add' ){			$lid 				= $this->_post('lid');			$wechaid 			= $this->_post('wechaid');			//$data['sn']			= $this->_post('sncode');			$data['phone'] 		= $this->_post('tel');			//$data['prize']		= $this->_post('winprize');			$data['wecha_name'] = $this->_post('wxname');			//$data['time']		= time(); 			//$data['islottery']	= 1;			//$data['usenums']	= 1;						$rid=intval($this->_post('rid'));			if (!$rid){				$thisRecord=$this->lottory_record_db->where(array('lid'=>$lid,'wecha_id'=>$wechaid,'islottery'=>1))->find();				$rid=$thisRecord['id'];			}			$rollback = $this->lottory_record_db->where(array('lid'=>$lid,'wecha_id'=>$wechaid,'id'=>$rid))->save($data);			$record=$this->lottory_record_db->where(array('id'=>$rid))->find();			echo'{"success":1,"msg":"恭喜!尊敬的<font color=red>'.$data['wecha_name'].'</font>请您保持手机通畅!你的领奖序号:<font color=red>'.$record['sn'].'</font>"}';			exit;			}	}

var_dump($_POST['action']); 条件は true、$rollback = $this->lottory_record_db->where(array('lid'=>) $lid,' wecha_id'=>$wechaid,'id'=>$rid))->save($data); このコードも実行されます データベース内にデータがあります

そして、出力されるのは次のとおりです。ただの json 文字列、解析するには js コードが必要ですか?

js コードの解析に問題がありますか?

次のコードは同じページにありますが、プロンプトが表示されます

public functionexchange(){

$this->lottory_record_db=M('Lottery_record');
$this->lottory_db=M('Lottery' ) ;
$this->lottory_pw_db=M('Lottery_pw');
if(IS_POST){
$this->lottory_pw_db->where(array('dpassword'=>trim($_POST) [ 'parssword'])))->find()
:0,"msg":"パスワードが間違っています"}';exit;
$data['sendtime'] = time();
$data['sendstutas'] = 1;
$data[' dname'] = $Lottery_pw['dname'];
$data['dpassword'] = $this-> ;lottory_record_db->where(array('id'=> intval ($_POST['rid'])))->save($data);
echo'{"success":1,"msg": "正常に受信しました","変更されました":1}';
}
}
}


jsコードの解釈に問題があるのでしょうか?
次のコードは同じページにありますが、プロンプトが表示されます
public functionexchange(){
$this->lottory_record_db=M('Lottery_record');
$this->lottory_db=M('宝くじ') ;

$this->lottory_pw_db=M('Lottery_pw');

if(IS_POST){

$this->lottory_pw_db->where(array('dpassword'=>trim() $_POST[ 'parssword'])))->find(); :0,"msg":"パスワードが間違っています"}';exit;
$data['sendtime'] = time( );
$data['sendstutas'] = 1;
$data['dname'] = $lottery_pw['dname'];
$data['dpassword'] = $lottery_pw['dpassword']; ->lottory_record_db->where(array('id'=> intval ($_POST['rid'])))->save($data);
echo'{"success":1,"msg ":"正常に受信しました","変更されました":1}';
}
}
}

jsコードを投稿してください

document.writeln("080b747a20f9163200dd0a7d304ba388");
document.writeln("");
document.writeln(".window {");
document.writeln(" width:290px;");
document.writeln(" 位置:固定;");
document.writeln(" 表示:なし;");
document.writeln("bottom:30px;");
document.writeln(" left:50%;");
document.writeln(" z-index:9999;");
document.writeln(" margin:-50px auto 0 -145px;");
document.writeln("padding:2px;");
document.writeln(" border-radius:0.6em;");
document.writeln(" -webkit-border-radius:0.6em;");
document.writeln(" -moz-border-radius:0.6em;");
document.writeln(" 背景色: #ffffff;");
document.writeln(" -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);");
document.writeln(" -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);");
document.writeln(" -o-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);");
document.writeln(" box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);");
document.writeln(" font:14px/1.5 Microsoft YaHei,Helvitica,Verdana,Arial,san-serif;");
document.writeln("}");
document.writeln(".window .title {");
document.writeln(" ");
document.writeln(" 背景色: #A3A2A1;");
document.writeln(" line-height: 26px;");
document.writeln(" padding: 5px 5px 5px 10px;");
document.writeln(" color:#ffffff;");
document.writeln(" font-size:16px;");
document.writeln(" border-radius:0.5em 0.5em 0 0;");
document.writeln(" -webkit-border-radius:0.5em 0.5em 0 0;");
document.writeln(" -moz-border-radius:0.5em 0.5em 0 0;");
document.writeln("background-image: -webkit-gradient(linear, left top, left bottom, from( #585858 ), to( #565656 )); /* Saf4+, Chrome */");
document.writeln("background-image: -webkit-linear-gradient(#585858, #565656); /* Chrome 10+, Saf5.1+ */");
document.writeln(" 背景画像: -moz-linear-gradient(#585858, #565656); /* FF3.6 */");
document.writeln(" 背景画像: -ms-linear-gradient(#585858, #565656); /* IE10 */");
document.writeln(" 背景-画像: -o-linear-gradient(#585858, #565656); /* Opera 11.10+ */");
document.writeln(" 背景画像: linear-gradient(#585858, #565656);");
document.writeln(" ");
document.writeln("}");
document.writeln(".window .content {");
document.writeln(" /*最小高さ:100px;*/");
document.writeln(" オーバーフロー:自動;");
document.writeln(" パディング:10px;");
document.writeln(" 背景: linear-gradient(#FBFBFB, #EEEEEE) repeat scroll 0 0 #FFF9DF;");
document.writeln(" color: #222222;");
document.writeln(" text-shadow: 0 1px 0 #FFFFFF;");
document.writeln(" border-radius: 0 0 0.6em 0.6em;");
document.writeln(" -webkit-border-radius: 0 0 0.6em 0.6em;");
document.writeln(" -moz-border-radius: 0 0 0.6em 0.6em;");
document.writeln("}");
document.writeln(".window #txt {");
document.writeln(" min-height:30px;font-size:16px; line-height:22px;");
document.writeln("}");
document.writeln(".window .txtbtn {");
document.writeln(" ");
document.writeln(" 背景: #f1f1f1;");
document.writeln("background-image: -webkit-gradient(linear, left top, left bottom, from( #DCDCDC ), to( #f1f1f1 )); /* Saf4+, Chrome */");
document.writeln("background-image: -webkit-linear-gradient( #ffffff , #DCDCDC ); /* Chrome 10+, Saf5.1+ */");
document.writeln(" 背景-画像: -moz-linear-gradient( #ffffff , #DCDCDC ); /* FF3.6 */");
document.writeln(" 背景画像: -ms-linear-gradient( #ffffff , #DCDCDC ); /* IE10 */");
document.writeln("background-image: -o-linear-gradient( #ffffff , #DCDCDC ); /* Opera 11.10+ */");
document.writeln(" 背景画像: linear-gradient( #ffffff , #DCDCDC );");
document.writeln(" border: 1px solid #CCCCCC;");
document.writeln(" border-bottom: 1px solid #B4B4B4;");
document.writeln(" color: #555555;");
document.writeln(" font-weight: bold;");
document.writeln(" text-shadow: 0 1px 0 #FFFFFF;");
document.writeln(" border-radius: 0.6em 0.6em 0.6em 0.6em;");
document.writeln(" display: block;");
document.writeln(" width: 100%;");
document.writeln(" box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);");
document.writeln(" text-overflow: ellipsis;");
document.writeln("white-space: nowrap;");
document.writeln(" カーソル: ポインタ;");
document.writeln(" text-align: windowcenter;");
document.writeln(" font-weight: bold;");
document.writeln(" font-size: 18px;");
document.writeln(" パディング:6px;");
document.writeln(" margin:10px 0 0 0;");
document.writeln("}");
document.writeln(".window .txtbtn:visited {");
document.writeln("background-image: -webkit-gradient(linear, left top, left bottom, from( #ffffff ), to( #cccccc )); /* Saf4+, Chrome */");
document.writeln("background-image: -webkit-linear-gradient( #ffffff , #cccccc ); /* Chrome 10+, Saf5.1+ */");
document.writeln(" 背景-画像: -moz-linear-gradient( #ffffff , #cccccc ); /* FF3.6 */");
document.writeln(" 背景画像: -ms-linear-gradient( #ffffff , #cccccc ); /* IE10 */");
document.writeln("background-image: -o-linear-gradient( #ffffff , #cccccc ); /* Opera 11.10+ */");
document.writeln(" 背景画像: linear-gradient( #ffffff , #cccccc );");
document.writeln("}");
document.writeln(".window .txtbtn:hover {");
document.writeln("background-image: -webkit-gradient(linear, left top, left bottom, from( #ffffff ), to( #cccccc )); /* Saf4+, Chrome */");
document.writeln("background-image: -webkit-linear-gradient( #ffffff , #cccccc ); /* Chrome 10+, Saf5.1+ */");
document.writeln(" 背景-画像: -moz-linear-gradient( #ffffff , #cccccc ); /* FF3.6 */");
document.writeln(" 背景画像: -ms-linear-gradient( #ffffff , #cccccc ); /* IE10 */");
document.writeln("background-image: -o-linear-gradient( #ffffff , #cccccc ); /* Opera 11.10+ */");
document.writeln(" 背景画像: linear-gradient( #ffffff , #cccccc );");
document.writeln("}");
document.writeln(".window .txtbtn:active {");
document.writeln("background-image: -webkit-gradient(linear, left top, left bottom, from( #cccccc ), to( #ffffff )); /* Saf4+, Chrome */");
document.writeln("background-image: -webkit-linear-gradient( #cccccc , #ffffff ); /* Chrome 10+, Saf5.1+ */");
document.writeln(" 背景-画像: -moz-linear-gradient( #cccccc , #ffffff ); /* FF3.6 */");
document.writeln(" 背景画像: -ms-linear-gradient( #cccccc , #ffffff ); /* IE10 */");
document.writeln("background-image: -o-linear-gradient( #cccccc , #ffffff ); /* Opera 11.10+ */");
document.writeln(" 背景画像: linear-gradient( #cccccc , #ffffff );");
document.writeln(" border: 1px solid #C9C9C9;");
document.writeln(" border-top: 1px solid #B4B4B4;");
document.writeln(" box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset;");
document.writeln("}");
document.writeln("");
document.writeln(".window .title .close {");
document.writeln(" float:right;"); document.writeln( "background-image:url(" data:image/png; base64、ivborw0kggoaaanasuheugaaaaboaaaaaaacpskzoaaaaaaaxnsr0iars4c6qaaaarnqua aajcaajajeajceajceajceajceajeajeajcahaarnqua aaax) actsurbvehl7dntcoagdazgb60nsgn1tplvcvnhmg76k8e1mwv+gg27cestq4pvtz69sfocbgpwa8+zht/up+in+mhgllumnie1cpbqb22cozibfpnxhfaizkyppheeeekph8442pnxhfaizkypffph8442pnxh ny2mppckpfmh6pwehwhknciyek69vfiuvhqjefds+ycwnbewxgqgifwyaaaaaasuvork5cyiii = ");"); ");
document.writeln(" width:26px;");
document.writeln(" 高さ:26px;");
document.writeln(" 表示:ブロック; ");
document.writeln("}");
document.writeln("531ac245ce3e4fe3d50054a55f265927");
document.writeln("7898725d6cc635baab8990ded84327b9");
document.writeln(" 898b2ba49b2993da97479e16e3344073消息喚起ea2c20da08542752598d7f323ef0177854bdf357c58b8a65c66d7c19c8e4d11416b28748ea4df4d9c2150843fecfba68") ;
document.writeln(" 5d1e94760349a02ec7e3e05385bc999a");
document.writeln(" 4a006659c3020d84d75430c12b9ea1bf16b28748ea4df4d9c2150843fecfba68");
document.writeln(" 392231c45654566e544dd623b2a06aae ");
document.writeln("

");
document.writeln("16b28748ea4df4d9c2150843fecfba68");
$(document).ready(function () {

$("#windowclosebutton").click(function () {
$("#windowcenter").slideUp(500);
});
$(" #alertclose").click(function () {
$("#windowcenter").slideUp(500);
});

}); 
function alert(title){
//var windowHeight; 
//var windowWidth; 
//var popWidth;  
//var popHeight; 
//windowHeight=$(window).height(); 
//windowWidth=$(window).width(); 
//popHeight=$(".window").height(); 
//popWidth=$(".window").width(); 
//var popY=(windowHeight-popHeight)/2; 
//var popX=(windowWidth-popWidth)/2; 
//$("#windowcenter").css("top",popY).css("left",popX).slideToggle("slow"); 
$("#windowcenter").slideToggle("slow"); 
$("#txt").html(タイトル);
//$("#windowcenter").hide("slow"); 
setTimeout('$("#windowcenter").slideUp(500)',8000);
}


function alert(title)


你在那里调用的?

$("#save-btn").bind("click",
function() {
var btn = $(this);
var tel = $("#tel").val();

var wechaid = $("#wechaid").val();
var winprize = $("#winprize").val();
var sncode = $("#sncode").val(); $("#lid").val();
//var RegPhone = /^([0-9]{11})?$/;
//var falg
//falg = tel.value.search (RegPhone);
if (!tel) {
alert("请输入正确{pigcms:$lottery.renametel}");
return
}

var submitData = {
sncode : sncode,
tel : tel 、

wechaid : wechaid,
winprize:winprize,
riding: {pigcms:$Coupon.rid},
蓋 : 蓋,
アクション : "追加"
};
$.post('index.php?g=Wap&m =クーポン&a=add', submitData,
function(data) {
if (data.success == true) {
window.location.href=location.href
//$(" #zjl").hide("slow");
return
} else {
//alert('失败'+data);
return
}
},"json")
});

$("#save-btnn").bind("click",
function () {
var submitData = {
id: {pigcms:$lottery.id},
rid: {pigcms:$Coupon.rid },
parssword: $("#parssword").val()
};
$.post('index.php?g=Wap&m=Coupon&a=exchange', submitData,
function (data) {
if (data) .success == true) {
alert(data.msg);
if (data.changed == true) {
window.location.href = location.href
}
return
} else {alert(data.msg; );}
},
"json")
});

$record=$this->lottory_record_db->where(array('id'=>$rid))->find();   

はありません、この条文は支持され、さらに下を次のように変更します、また、拡張できません


echo'{"success":1,"msg":"恭喜" }';
終了します。    

}



if ($Lottery_pw['dpassword'] != trim($this->_post('parssword'))){
echo'{"success":0,"msg":"密码不正确"}';出口;
}else {
$data['sendtime'] = time(); 

$data['sendstutas'] = 1;

$data['dname'] = $Lottery_pw['dname'];
$data['dpassword'] = $Lottery_pw['dpassword'];
$this->lottory_record_db->where(array('id'=> intval($_POST['rid'])))->save($data);
echo'{"success":1,"msg":"领取成功","changed":1}';
}
}
}

昨晩晚又测试、発行现密码错误の時候会示唆、输入正确的時候不提示

如果你确认有进入,那说明上面有码発行陪審、停止しました。 陪審情報を放出します。見てください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
前の記事:PHP 言語を使用して段階的電力充電方法を編集する次の記事:PHP 言語を使用して段階的電力充電方法を編集する

関連記事

続きを見る