in ,

為什麼我的PHP 的header 無法work? 原來是這邊需要修正!

header()函式的主要功能是將HTTP協議標頭(header)輸出到瀏覽器。可以直接把頁面轉到特定你所指定的網址,如果您遇到 php 的header 轉址功能無法WORK,您可以參考如下

https://stackoverflow.com/questions/6309370/php-header-…/

的這段

i had also faced this issue many time. i solved it by putting a die(); on the next line of header(“Location: http://www.google.com“);
someting like this
header(“Location: http://www.google.com“); die();

或這裡http://php.net/manual/en/function.header.php

代碼如下

<?php
header(“Location: http://www.example.com/”); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>

 

文章來源 : https://wpoki.com

Written by 婷Z

Comments

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。

GIPHY App Key not set. Please check settings