wp_original_referer_field()
wp_original_referer_field( bool $echo = true, string $j…
wp_original_referer_field( bool $echo = true, string $jump_back_to = ‘current’ )
检索或显示窗体的原始referer隐藏字段。
Retrieve or display original referer hidden field for forms.
目录锚点:#说明#参数#源码
说明(Description)
输入名称为”u wp_original_http_referer’,如果该名称已发布,则将与wp_referer_field()的值相同;如果不存在,则它将是当前页。
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $echo | (bool) | 是否回显原始http referer。 |
| $jump_back_to | (string) | 可以是“上一页”或要跳回的页。 |
源码(Source)
/**
* Retrieve or display original referer hidden field for forms.
*
* The input name is '_wp_original_http_referer' and will be either the same
* value of wp_referer_field(), if that was posted already or it will be the
* current page, if it doesn't exist.
*
* @since 2.0.4
*
* @param bool $echo Optional. Whether to echo the original http referer. Default true.
* @param string $jump_back_to Optional. Can be 'previous' or page you want to jump back to.
* Default 'current'.
* @return string Original referer field.
*/
function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
if ( ! $ref = wp_get_original_referer() ) {
$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
}
$orig_referer_field = '';
if ( $echo )
echo $orig_referer_field;
return $orig_referer_field;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.0.4 | wp-includes/functions.php | 11 | 10 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!