我设法通过API使用PHP在Tumblr上创建帖子但我仍然很难在帖子中有多个图像 . API表示您可以创建一个数组作为数据参数:https://www.tumblr.com/docs/en/api/v2#blog-submissions但我不确定如何解释描述"One or more image files (submit multiple times to create a slide show)" . 这是什么意思:"submit multiple times"?

所以我用一张照片创建照片的代码如下

$parameters = array( );
$parameters['type'] = "photo";
$parameters['title'] = $title;
$parameters['caption'] = $caption;
$parameters['date'] = $date;
$parameters['data'] = file_get_contents( '/path/to/file.jpg' );

$post = $tum_oauth->post($post_URI,$parameters);

使用本网站提供的代码时:http://techslides.com/tumblr-api-example-using-oauth-and-php这样可以正常使用 .

由于API表示您可以使用数组作为数据参数,因此我尝试使用以下内容上传多张照片:

$parameters = array( );
$parameters['type'] = "photo";
$parameters['title'] = $title;
$parameters['caption'] = $caption;
$parameters['date'] = $date;
$parameters['data'] = array( file_get_contents( 'path/to/file1.jpg' ), file_get_contents( 'path/to/file2.jpg' ) );

$post = $tum_oauth->post($post_URI,$parameters);

然后我收到此错误消息:

object(stdClass)#48(2){[“meta”] => object(stdClass)#49(2){[“status”] => int(401)[“msg”] => string(14) “未授权”} [“response”] => array(0){}}

我不认为它与授权有关,因为当我只使用一张照片时它可以工作 . 图像大小为1.3MB和0.9MB - API表示URL编码二进制文件的限制为10MB .

在这里我找到了"working example"但是这里传递多张照片的方式对我不起作用:https://gist.github.com/codingjester/1649885

我需要改变什么才能让它发挥作用?