我们的网站有两种语言版本,捷克语和英语。我们在每个页面的右上角(在 header.php 中)有一个简单的标志,它指向捷克索引的 index_cz.php 和所有页面的英语索引 index.php,无论当前 URL 是什么。
<a href="index_cz.php" target="_self"><img src="img/Czech-icon.png" width="64" height="64" alt="Czech language version"></a>
<a href="index.php" target="_self"><img src="img/United-Kingdom-icon.png" width="64" height="64" alt="English language version">
我想要使用 PHP 的更复杂的东西,它可以根据当前页面的 URL 更改按钮的 URL。例如:如果当前页面是“new.php”,我希望捷克语按钮现在指向“new_cz.php”,而英文按钮是“new.php”。
包含?id=结尾的页面(具有与该页面关联的任何 id)使用单独的 header.php 并从数据库中引用适当的 id,例如:
<a href="project_cz.php?id=<?php echo $det[0];?>" target="_self"><img src="img/Czech-icon.png" width="64" height="64" alt="Czech language version"></a>
<a href="project.php?id=<?php echo $det[0];?>" target="_self"><img src="img/United-Kingdom-icon.png" width="64" height="64" alt="English language version"></a>
你能想出合适的代码来处理标准的 php 页面吗?非常感谢!