wp_handle_sideload()
wp_handle_sideload( array $file, array|bool $overrides …
wp_handle_sideload( array $file, array|bool $overrides = false, string $time = null )
_wp_handle_upload()的包装。
Wrapper for _wp_handle_upload().
目录锚点:#说明#参数#源码#笔记
说明(Description)
传递“wp_handle_sideload”操作。另请参见#另请参阅_wp_handle_upload()
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $file | (array) | 一个类似于PHP$u FILES POST数组的数组 |
| $overrides | (array | bool) | 名称=>值的关联数组覆盖默认变量。 |
| $time | (string) | 时间格式为“yyyy/mm”。 |
源码(Source)
/**
* Wrapper for _wp_handle_upload(), passes 'wp_handle_sideload' action
*
* @since 2.6.0
*
* @see _wp_handle_upload()
*
* @param array $file An array similar to that of a PHP $_FILES POST array
* @param array|bool $overrides Optional. An associative array of names=>values to override default
* variables. Default false.
* @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
* @return array On success, returns an associative array of file attributes. On failure, returns
* $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
*/
function wp_handle_sideload( &$file, $overrides = false, $time = null ) {
/*
* $_POST['action'] must be set and its value must equal $overrides['action']
* or this:
*/
$action = 'wp_handle_sideload';
if ( isset( $overrides['action'] ) ) {
$action = $overrides['action'];
}
return _wp_handle_upload( $file, $overrides, $time, $action );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.6.0 | wp-admin/includes/file.php | 10 | 4 |
笔记(Notes)
例子
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





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