Php 重定向后如何重定向?
重定向到谷歌后,我想自动返回我的主页。我试图在这段代码上使用APIPhp 重定向后如何重定向?,php,Php,重定向到谷歌后,我想自动返回我的主页。我试图在这段代码上使用API public function update_order(){ $nom = $this->uri->segment(3); $data_order = $this->data->getdataorder2($nom); foreach($data_order as $order){ $nama = $order->nama;
public function update_order(){
$nom = $this->uri->segment(3);
$data_order = $this->data->getdataorder2($nom);
foreach($data_order as $order){
$nama = $order->nama;
$email = $order->email;
$telepon = $order->telepon;
$tanggal = $order->tanggal;
$waktu = $order->waktu;
$jumlahorang = $order->jumlah_orang;
$catatan = $order->catatan;
}
$data= array(
'status' => 'confirmed'
);
$this->data->simpanupdateorder($nom,$data);
**redirect('http://google.com)->redirect('index.php/welcome/index');**
}
编辑:
在尝试之后,我意识到谷歌也不允许这样做(iframe)
因此,据我所知,没有适合您的解决方案,但此解决方案可能对其他网站有所帮助
TL;DR:您离开域后无法再次重定向 一旦你离开了托管区,你就不能再控制代码了。你可以将你的网站重定向到谷歌
<html>
<?php
header('Location: https://www.google.com/');
exit;
?>
当你的页面被重定向到谷歌并重新打开后,就再也回不去了
您所能做的最好的事情就是在iframe中打开网页,然后返回。(我不知道为什么需要这样做。)
你的头衔
正文,html
{
边距:0;填充:0;高度:100%;溢出:隐藏;
}
#内容
{
位置:绝对;左侧:0;右侧:0;底部:0;顶部:0px;
}
这将在您的网站区域打开完整的Google页面,您可以在此处实现php代码。这是不可能的,因为您无法控制Google页面本身。你能解释一下你想要实现什么,这样我们就可以找到一个解决办法吗?尝试多重重定向,google.com就是一个例子。我想将它用于我的api,这样当数据已经发送到api站点时,它也会更新数据库中的数据。这很难解释:/谢谢,它已经在运行了,但我仍然在寻找代码,给时间重定向网站。当我通过重定向代码打开google时,只需要几次,然后返回我的主页。这是可能的吗?因为上述原因,不可能对所有外部网站进行访问。我猜:你想在你的索引/欢迎页面上显示确认状态,但它在执行查询之前显示数据,对吗?是的,像那样,还有其他方式吗,兄弟?
<html>
<?php
header('Location: https://www.google.com/');
exit;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Your Title</title>
<style type="text/css">
body, html
{
margin: 0; padding: 0; height: 100%; overflow: hidden;
}
#content
{
position:absolute; left: 0; right: 0; bottom: 0; top: 0px;
}
</style>
</head>
<body>
<div id="content">
<iframe width="100%" height="100%" frameborder="0" src="https://www.google.com" />
</div>
</body>
</html>