近期发现页面跳转挺麻烦,打开链接后,显示评论者的网址,然后还需要点击一下才会跳转过去,本意只是隐藏评论者网址,以下是修改后的goto文件的代码,记录一下。

<?php
// Extract and decode the URL from the query parameter
$url = isset($_GET['url']) ? $_GET['url'] : '';
$decoded_url = base64_decode($url);

// Validate the decoded URL to ensure it's a valid URL
if (filter_var($decoded_url, FILTER_VALIDATE_URL)) {
// Perform the redirect
header("Location: $decoded_url");
exit;
} else {
// Fallback if the decoded URL is invalid
echo '<div style="max-width: 600px; width: 100%; margin: 0 auto; position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%);">
<main style="margin: 0 auto; max-width: 100%; padding: 0 30px; font-size: 1.3em;">
<div style="color: #6b7280; padding: 0 0 15px; line-height: 2em;">无效的URL,请检查链接。</div>
</main>
</div>';
}
?>