Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定标题,如何在 MediaWiki 中获取文章的 URL?
我现在想使用 PHP 以编程方式在皮肤模板中创建指向某些页面的链接,我正在这样做:
<a href="<?php $wgScriptPath ?>/index.php/Page_title">Page title</a>
这有点太罗嗦了,我想要一些东西
<?php page_link_by_title("Page_title") ?>
谢谢!
上面的答案应该可以正常工作,除了一个小错字(文本而不是测试)。
$title = Title::newFromText("Title"); $title->getFullURL();
试试这个
这应该创建一个新的标题类 (svn.wikimedia.org/doc/classTitle.html),并检索完整的 URL。