【发布时间】:2013-11-11 02:03:20
【问题描述】:
<? echo "<script> document.location.href='main.php';</script>"; ?>
这段代码运行良好
但是,从表单页面发送值
<form action="smssend.php" method="post" id="quickform">
<input type="hidden" name="returnUrl" value="<? =PHP_SELF?>">
这会为下一页提供一个值
<? echo "<script> document.location.href='$_POST[returnUrl]';</script>"; ?>
如果源和页面不会移动,则会发生运行时错误。
我错了吗?
在表单页面下我收到了来自电话号码的消息,参考页面来源处理较少。
<?php
$config['SMS_ID']="test";
$config['SMS_PW']="test1234";
$config['cf_tel']='01234567';
$post_data = array(
"remote_id" => $config['SMS_ID'],
"remote_pass" => $config['SMS_PW'],
"remote_num" => 1,
"remote_reserve" => 0,
"remote_phone" => $_POST[number],
"remote_callback" => $config['cf_tel'],
"remote_msg" => $_POST[counsle]
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.mymunja.co.kr/Remote/RemoteSms.html" );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$msg = curl_exec($ch);
curl_close($ch);
?>
<? echo "<script> alert('Done');</script>"; ?>
<? echo "<script> document.location.href='$_POST[returnUrl]';</script>"; ?>
【问题讨论】:
-
尝试 var_dumping
var_dump($_POST["returnUrl"]);并发布输出 .. 请发布您遇到的错误,以便我们清楚地了解问题所在 -
请分享更多细节。这是PHP问题,还是JS问题?为什么这个问题用 SMS 标记?