很多站长朋友们都不太清楚phppost怎么跳转,今天小编就来给大家整理phppost怎么跳转,希望对各位有所帮助,具体内容如下:
本文目录一览: 1、 thinkphp jquery的$post然后跳转怎么实现? 2、 post带参数跳转' title='php===>post带参数跳转'>php===>post带参数跳转 3、 PHP 怎么用POST方式跳转界面 但不改变网址? 必采纳 4、 php如何实现提交后跳转 thinkphp jquery的$post然后跳转怎么实现?function willCate(){
$.post("{:U('Home/SellSth/willcate')}", { "id":"你的商品id" },
function(data){
window.location.href="你要跳转的地址";
}, "text");
}
post后有一个请求成功的函数 在那个函数里加跳转代码就可以了
post带参数跳转'>php===>post带参数跳转好绕口,post可以在当前页面提交处理的。不必post到新页面。
另外,你可以了解一下ajax
ajax简单示例
a页面
$(function(){
$.ajax({
url: "ajax_php.php",
type: "POST",
data:{trans_data:"要传输的内容"},
error: function(){
alert('Error loading XML document');
},
success: function(data,status){//如果调用php成功
alert(unescape(data));//解码,显示汉字
}
});
});
ajax处理页面
$backValue=$_POST['trans_data'];
echo $backValue."+后台返回";
上面只是例子
PHP 怎么用POST方式跳转界面 但不改变网址? 必采纳<?php
if (isset($_POST["username"]) and ($_POST["username"])!=""){
echo "您输入了:".$_POST["username"];
}else{
echo"<form id=\"myForm\" name=\"myForm\" action=\"\" method=\"POST\">
<input type=\"text\" placeholder=\"请输入\" name=\"username\" id=\"username\" value=\"\" />
<input type=\"submit\" name=\"loginBtn\" value=\"提交\" class=\"btn\"/>
<input type=\"reset\" name=\"cancelBtn\" value=\"取消\" class=\"btn\"/>
</form>";
}
?>
php如何实现提交后跳转<?php
//========================== 定义redirect() 开始 =========================//
/**
* 定义redirect()跳转函数,是用来在用户操作后,页面根据要求跳转到指定页面
*
* @param unknown_type $ms 是用来调整跳转所需要的秒数
* @param unknown_type $url 是指定跳转到的地址
* @param unknown_type $text 是显示跳转时候的信息
*/
function redirect($ms ='', $url='', $text=''){
echo <<<EOT
<meta http-equiv="refresh" content=$ms;URL=$url>
<div align="center">
<table width="600" border="0" cellpadding="1" cellspacing="1" class="tableoutline">
<tr>
<td colspan="3"><table width="100%" border="0" cellpadding="5" cellspacing="1">
<tr>
<td valign="bottom"><div align="center">页面操作提示</div></td>
</tr>
<tr>
<td><div align="center">$text</div></td>
</tr>
<tr>
<td><div align="center"><a href="$url" mce_href="$url">本页面在 $ms 秒后自动跳转,如果您的浏览器没有跳转,点此链接返回。</a></div>
</td>
</tr>
</table></td>
</tr>
</table>
</div>
EOT;
}
//========================== 定义redirect() 结束 =========================//
?>
使用的时候是:
redirect('2','adduser.php','增加用户已经成功!稍后返回!');
其中 2 表示秒数,adduser.php 是所跳转的页面, "增加用户已经成功!稍后返回!" 是跳转等待的时候所显示的信息!
关于phppost怎么跳转的介绍到此就结束了,不知道本篇文章是否对您有帮助呢?如果你还想了解更多此类信息,记得收藏关注本站,我们会不定期更新哦。
查看更多关于phppost怎么跳转 php 跳转到指定url的详细内容...