簡體   English   中英

從SQL表中獲取文本值以在標頭中使用:位置

[英]Fetching text value from SQL table to use in header: Location

我想從此SQL表中獲取landing_page值並將其添加到標頭位置

:Ive在頁面頂部有以下代碼,但這給了我空白頁面:

 <?php  
     foreach($[user_name] as $user) {
    $location="Location:http://".$user['landing_page'];
    header($location);
 }
 ?>

<!-- if you need user information, just put them into the $_SESSION variable and output them here -->
Order: <?php echo $_SESSION['user_name']; ?>. You are securely logged in.

我要去哪里錯了?

在此處輸入圖片說明

在此處輸入圖片說明

原始代碼是一個登錄腳本,我嘗試使用戶登錄后進入google.com。

您沒有正確附加變量。 試試看,

header('"'.$user['landing_page'].'");

我認為您可以通過在標頭中附加參數來實現

header("Location: " . $user['landing_page']);

嘗試這個:

<?php
header("Location: ".$user['landing_page']);
?>

嘗試這個

 <?php  
     foreach($user_name as $user) {
        header("Location:http://".$user['landing_page']);
     }
 ?>

要么

<?php  
     foreach($user_name as $user) {
        $location="Location:http://".$user['landing_page'];
        header($location);
     }
 ?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM