第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

多個(gè)標(biāo)頭/

多個(gè)標(biāo)頭/

PHP
慕哥9229398 2022-09-25 20:45:58
我使用標(biāo)題在提交后顯示成功消息。我還想在5秒后將用戶重定向到索引.php頁(yè)面,但不知何故它不起作用。if(mysqli_query($link, $sql)){    header("Location: addbusiness.php?message=<div class='alert alert-success' role='alert' style='text-align: center; margin-bottom: 50px;'>Succes.</div>");    header( "refresh:5;url=index.php" );} else{    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);}
查看完整描述

1 回答

?
慕斯王

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超2個(gè)贊

您根本無法同時(shí)執(zhí)行,因此您必須將兩個(gè)標(biāo)題分開,即應(yīng)該是顯示消息的頁(yè)面的一部分。此外,沒有理由(實(shí)際上是一種不好的做法)將整個(gè)HTML傳遞到URL中,最好使用一些ID,例如:locationrefreshrefresh


數(shù)據(jù)庫(kù).php


<?php

    if(mysqli_query($link, $sql)){

        header("Location: addbusiness.php?message=1");

    } else{

        echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);

    }

?>

附加業(yè)務(wù).php


<?php

    if(!empty($_GET['message'])){

        if($_GET['message'] == 1){

            header( "refresh:5;url=index.php" );

            echo "<div class='alert alert-success' role='alert' style='text-align: center; margin-bottom: 50px;'>Success.</div>";

        }else{

            //do something else

        }

    }

?>

基于這樣的條件,您還將避免每次訪問時(shí)刷新addbusiness.php


當(dāng)然,在任何情況下,您都必須確保在調(diào)用之前沒有任何HTML輸出到瀏覽器。在兩個(gè)頁(yè)面中。header()


查看完整回答
反對(duì) 回復(fù) 2022-09-25
  • 1 回答
  • 0 關(guān)注
  • 102 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)