我在这个页面中有一个名为 page-about-us.php 的页面,我有一个指向另一个页面的链接,该页面将链接到 accreditations.php。通过我的 page-about-us.php 文件执行此操作的正确方法是什么?
最佳答案
相对链接是网络基础知识中最好的 friend 之一。
<a href="accreditations.php">Relative Link</a>
<a href="://example.com/accreditations.php">Absolute Link</a>
第一个链接将始终使用当前目录/位置并从这里开始。如果您在诸如 http://example.com/inner/directory/page-about-us.php
之类的页面上然后单击它,它将带您到 http://example.com/inner/directory/accreditations.php
。
对于绝对链接,无论当前位置如何,链接总是到指定的 URL。
关于php - 在 wordpress 中链接到页面的正确方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44052632/