Skip to content

Commit

Permalink
改进跳转页面
Browse files Browse the repository at this point in the history
1.判断本站地址用str_starts_with
2.去除跳转连接上的a标签
  • Loading branch information
Lvshujun0918 committed Mar 25, 2024
1 parent 1f1bb7c commit 5fae991
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions inc/go.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
if (strpos($url, "https://") !== 0 && strpos($url, "http://") !== 0) {
$error = "跳转链接协议有误";
} else {
if (strpos($url, home_url()) === 0) {
if (str_starts_with($url, home_url()) === 0) {
header("Location:" . $url);
exit();
}
Expand All @@ -37,9 +37,7 @@
<p class="mt20"><?php echo $error ?></p>
<?php else: ?>
<p class="mt20">
<span>您即将离开<?php echo get_bloginfo('name') ?>跳转至</span>
<a class="a-link text-line" rel="nofollow"
href="<?php echo $url ?>"><?php echo empty($name) ? $url : $name; ?></a><span> ,确定进入吗?</span>
<span>您即将离开<?php echo get_bloginfo('name') ?>跳转至</span><?php echo empty($name) ? $url : $name; ?><span> ,确定进入吗?</span>
</p>
<?php endif; ?>
<div class="text-center mt20">
Expand Down

0 comments on commit 5fae991

Please sign in to comment.