0

我曾经有一个脚本,该脚本基本上对链接进行了 base64 编码,然后重定向 PHP 页面将对其进行解码并将您发送到该页面。

我不知道我做错了什么,PHP 不是我最好的技能,只是寻求一些帮助。

页面链接:

<a href="http://www.XXXXXX.com/find.php?shop=<?php echo urlencode(base64_encode("long ass link goes here"));  ?>">Test</a> 

查找.php:

< ?php

    $request_id = $_GET ['shop'];
    $site = base64_decode($request_id);

    header( 'Location: $site' ) ;

?>
4

2 回答 2

1

如果要在字符串中使用 $variables,请使用双引号:

header("Location: $site");

或连接字符串:

header('Location: '.$site);

更多信息在这里

+++ 但最好将该值存储到 $_SESSION 中,因为用户可以更改它,它会带来错误。

于 2010-12-20T02:07:52.627 回答
0

如果您复制并粘贴了第二个代码,请尝试删除 和 之间的<空格?。应该是<?php

于 2010-12-20T02:15:08.197 回答