我想删除 $_SERVER['REQUEST_URI']; 输出的第一个文件夹
// I use it as language switcher in my website, here's how it works:
<?php $currenturl=$_SERVER['REQUEST_URI']; ?>
<a href="https://mysite.com/<?php echo $currenturl ?>">United States</a>
<a href="https://mysite.com/ca<?php echo $currenturl ?>">Canada</a>
<a href="https://mysite.com/br<?php echo $currenturl ?>">Brasil</a>
问题是,例如在加拿大,它输出:
https://mysite.com/ca/ca/mypage
它应该是