PHP请求 - 在此服务器上找不到请求的URL /.$final_link

时间:2018-05-29 03:31:25

标签: php redirect

当我尝试访问我的php文件时,我收到此错误。它说在服务器上找不到链接。我尝试回显它返回的链接,我得到了正确的链接,当我尝试手动访问它时,它加载但是当我使用重定向时,我得到了错误。

这是我的代码:

<?php
    session_start();

    $user_id = $_SESSION['user_id'];
    $api_id = $_SESSION['api_id'];
    $limit =  $_SESSION['limit'];

    $final_link = 'http://www.mywebsite.info/payment/public/createPayment/' .$user_id .'/' .$api_id .'/' .$limit;
    echo $final_link;
    header('Location: .$final_link');
    exit;
    unset($_SESSION["user_id"]);
    unset($_SESSION["api_id"]);
    unset($_SESSION["limit"]);
?>

2 个答案:

答案 0 :(得分:0)

试试这个:

<?php
session_start();

$user_id = $_SESSION['user_id'];
$api_id = $_SESSION['api_id'];
$limit =  $_SESSION['limit'];

$final_link = 'http://www.mywebsite.info/payment/public/createPayment/' .$user_id .'/' .$api_id .'/' .$limit;
echo $final_link;
header("Location: {$final_link}"); // changed in double quotes
exit;
unset($_SESSION["user_id"]);
unset($_SESSION["api_id"]);
unset($_SESSION["limit"]);
?>

答案 1 :(得分:0)

试试这个:

blogdown::serve_site()