This question already has an answer here: How to make a redirect in PHP? 27 answers You can just use the header() function of PHP. But be sure that there is NO output before the header() call or it will fail. if(HERE YOUR CONDITION) { header("Location: confirm.php"); } ob_clear(); //Make sure you've done ob_start() or not output anything to the browser header('Location: confirm.php
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 你可以使用PHP的header()函数。 但请确保在header()调用之前没有输出,否则将失败。 if(HERE YOUR CONDITION) { header("Location: confirm.php"); } ob_clear(); //Make sure you've done ob_start() or not output anything to the browser header('Location: confirm.php'); exit; 放头(“Location:confirm.php”); 在你的条件。
This question already has an answer here: How to make a redirect in PHP? 27 answers As long as you have not outputted anything to the browser, you can do a header redirect. This will achieve your aim. Change this: echo ("<center><a href='home.php'>Redirect</a></center>"); $_SESSION['username'] = $username; To this: $_SESSION['username'] = $username; header("Loca
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 只要你没有输出任何东西到浏览器,你可以做一个头重定向。 这将实现你的目标。 改变这个: echo ("<center><a href='home.php'>Redirect</a></center>"); $_SESSION['username'] = $username; 为此: $_SESSION['username'] = $username; header("Location: /some-new-page.php"); exit; 总是exit; 位置重定向后。 哦,
This question already has an answer here: How to make a redirect in PHP? 27 answers 尝试: header("Location: http://www.google.com/"); exit;
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 尝试: header("Location: http://www.google.com/"); exit;
This question already has an answer here: How to make a redirect in PHP? 27 answers This will work if you haven't written anything on the page yet: header( 'Location: http://www.yoursite.com/new_page.html' ) ; If you have, you'll have to use javascript for redirection: <script>window.location.href = "http://www.yoursite.com/new_page.html";</script> use this header( '
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 如果你还没有在页面上写任何东西,这将工作: header( 'Location: http://www.yoursite.com/new_page.html' ) ; 如果你有,你必须使用javascript进行重定向: <script>window.location.href = "http://www.yoursite.com/new_page.html";</script> 用这个 header( 'Location: http://www.yoursite.com/new_page.html' ) ; 要么 header( 'L
This question already has an answer here: How to make a redirect in PHP? 27 answers You may redirect user to current file. After: $updateQuery->execute(); Add: header("Location: yourfile.php"); //header("Location: ".basename(__FILE__, '.php')); Might work too This will redirect user to this file after executing query. // REFRESH PAGE echo "<meta http-equiv='refresh' content='0'&g
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 您可以将用户重定向到当前文件。 后: $updateQuery->execute(); 加: header("Location: yourfile.php"); //header("Location: ".basename(__FILE__, '.php')); Might work too 这会在执行查询后将用户重定向到此文件。 // REFRESH PAGE echo "<meta http-equiv='refresh' content='0'>";
This question already has an answer here: How to make a redirect in PHP? 27 answers Use header function like this: header('Location: login.php'); exit; But don't print any html output before calling header function else it will result in an error. Try something like this : <?php session_start(); //do some login processing if(login === true){ exit(header('Location: home.php')
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 使用这样的标题功能: header('Location: login.php'); exit; 但是在调用头函数之前不要打印任何html输出,否则会导致错误。 尝试这样的事情: <?php session_start(); //do some login processing if(login === true){ exit(header('Location: home.php')); }else{ //Extra marks set a reason why failed $_SESSION['error'] = 'Some
This question already has an answer here: How to make a redirect in PHP? 27 answers You can have your submit script check for a failure and redirect to the index.html for adding more on success. Bear in mind that you'll have to set the header before you output any other data with echo. header('refresh: 3; URL=index.html'); Don't use mysql, use mysql i or PDO. Learn ab
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 您可以让您的提交脚本检查失败并重定向到index.html以获得更多成功。 请记住,在使用echo输出任何其他数据之前,您必须设置标题。 header('refresh: 3; URL=index.html'); 不要使用mysql,请使用mysql i或PDO。 了解SQL注入。 所以你的sumbit.php可能看起来像这样: <?php include 'config.php'; // store your configuration in a se
This question already has an answer here: How to make a redirect in PHP? 27 answers To do this follow these steps: 1. Link is to make using target blank. Example: Open link in a new window or tab: <a href="alvinshortener.com/index.php?url=www.google.com" target="_blank">Visit </a> inside index.php write: <?php if(isset($_GET['url'])){ header("Location: $_GET['url']");
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 为此请按照下列步骤操作: 1.链接是使用目标空白。 例: 在新窗口或标签中打开链接: <a href="alvinshortener.com/index.php?url=www.google.com" target="_blank">Visit </a> 在index.php里面写: <?php if(isset($_GET['url'])){ header("Location: $_GET['url']"); } ?> 也许我可以帮忙。 在ASP.NET中,我们使用AdRotator
This question already has an answer here: How to make a redirect in PHP? 27 answers Write header like: header("Location: http://www.testing.com"); on the home page of http://www.testing.com/newsite for more about header So simply add below line at index page. header("Location: http://www.testing.com", false, 301); exit; Or write it in common file that are included in every page.
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 写头像: header("Location: http://www.testing.com"); 在http://www.testing.com/newsite的主页上 有关标题的更多信息 所以,只需在索引页面添加下面一行。 header("Location: http://www.testing.com", false, 301); exit; 或者将其写入每个页面中包含的公共文件中。 确保在标头位置有http:// ,否则它会查找目录。 并且exit; 在最后,
This question already has an answer here: How to make a redirect in PHP? 27 answers 使用PHP: header('Location: login.php'); exit; //prevents further page loading header('Location: '.$URL); The best way I know. For a really good answer, check this out: How to make a redirect in PHP?
这个问题在这里已经有了答案: 如何在PHP中进行重定向? 27个答案 使用PHP: header('Location: login.php'); exit; //prevents further page loading header('Location: '.$URL); 我知道的最好的方式。 对于一个非常好的答案,请查看:如何在PHP中进行重定向?