php 在php中打开另一个页面

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7865984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 03:31:43  来源:igfitidea点击:

Open another page in php

phpredirect

提问by prometheuspk

Possible Duplicate:
PHP page redirect

可能重复:
PHP 页面重定向

how do i redirect to another page in php, once a process is finished.

一旦进程完成,我如何重定向到 php 中的另一个页面。

for example my <form>tag sets the action attribute to "process.php". After the process on process.php is finished i want it to redirect to the site it cam from. how is that done?

例如,我的<form>标签将 action 属性设置为“process.php”。在 process.php 上的进程完成后,我希望它重定向到它来自的站点。这是怎么做的?

回答by NoPHPknowldege

Use the following code:

使用以下代码:

if(processing == success) {
  header("Location:filename");
  exit();
}

And you are good to go.

你很高兴去。

回答by Sven

<?php
    header("Location: index.html");
?>

Just make sure nothing is actually written to the page prior to this code, or it won't work.

只需确保在此代码之前没有实际写入页面,否则它将无法工作。

回答by orangething

Use something like header( 'Location: /my-other-page.html' );to redirect. You can't have sent any other data on the page before you do this though.

使用类似header( 'Location: /my-other-page.html' );重定向的东西。但是,在执行此操作之前,您不能在页面上发送任何其他数据。

回答by Kamil Lach

header( 'Location: http://www.yoursite.com/new_page.html' );

in your process.phpfile

在你的过程中。php文件