WordPress相当于Drupal的url()

时间:2010-05-24 22:39:13

标签: php wordpress drupal url-rewriting

Drupal url()是否有任何WordPress等效函数?

2 个答案:

答案 0 :(得分:3)

link-template.php中查看文件wp-includes

它充满了有用的URL功能! (还可以查看category-template.phpget_category_link()的{​​{1}}。

答案 1 :(得分:1)

根据drupal函数的文档,我认为你最接近的就是site_url()。

/**
 * Retrieve the site url for the current site.
 *
 * Returns the 'site_url' option with the appropriate protocol,  'https' if
 * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
 * overridden.
 *
 * @package WordPress
 * @since 2.6.0
 *
 * @uses get_site_url()
 *
 * @param string $path Optional. Path relative to the site url.
 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'.
 * @return string Site url link with optional path appended.
*/
site_url(string path, string scheme);