WordPress: Function Reference/wp redirect:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
无编辑摘要
 
第1行: 第1行:
== Description ==
== 描述==
== 描述==
Redirects the user to a specified [[WordPress:Glossary#Absolute_URI|''absolute'' URI]].


将用户导向规定的[[WordPress:Glossary#Absolute_URI|''absolute'' URI]]。
将用户导向规定的[[WordPress:Glossary#Absolute_URI|''absolute'' URI]]。


== Parameters ==
== 参数 ==
== 参数 ==
{{Parameter|$location|string|The '''absolute''' URI which the user will be redirected to.}}
{{Parameter|$status|integer|The status code to use|optional|302}}


{{Parameter|$location|string|用户被导向到的 '''absolute''' URI 。}}
{{Parameter|$location|string|用户被导向到的 '''absolute''' URI 。}}
{{Parameter|$status|integer|需要使用的级别代码。|optional|302}}
{{Parameter|$status|integer|需要使用的级别代码。|optional|302}}
== Usage ==


== 用法 ==
== 用法 ==


%%% <?php wp_redirect($location, $status); ?> %%%
%%% <?php wp_redirect($location, $status); ?> %%%
%%% <?php wp_redirect($location, $status); ?> %%%
== Example ==


== 例子 ==
== 例子 ==
<?php wp_redirect(get_option('siteurl') . '/wp-login.php'); ?>


<?php wp_redirect(get_option('siteurl') . '/wp-login.php'); ?>
<?php wp_redirect(get_option('siteurl') . '/wp-login.php'); ?>
Redirects can also be external, and/or use a "Moved Permanently" code :


重新导向也可以是外部操作,和/或者使用"永远移除"代码:
重新导向也可以是外部操作,和/或者使用"永远移除"代码:
<pre><nowiki><?php wp_redirect('http://www.example.com', 301); ?></nowiki></pre>
<pre><nowiki><?php wp_redirect('http://www.example.com', 301); ?></nowiki></pre>
<pre><nowiki><?php wp_redirect('http://www.example.com', 301); ?></nowiki></pre>

2008年7月29日 (二) 15:44的最新版本

描述[ ]

将用户导向规定的absolute URI

参数[ ]

用法[ ]

%%% <?php wp_redirect($location, $status); ?> %%%

例子[ ]

<?php wp_redirect(get_option('siteurl') . '/wp-login.php'); ?>

重新导向也可以是外部操作,和/或者使用"永远移除"代码:

<?php wp_redirect('http://www.example.com', 301); ?>