public function testBatchStat() { $key2 = 'testOp2' . getTid(); Qiniu_RS_Delete($this->client, $this->bucket, $key2); $entries = array(new Qiniu_RS_EntryPath($this->bucket, $this->key), new Qiniu_RS_EntryPath($this->bucket, $key2)); list($ret, $err) = Qiniu_RS_BatchStat($this->client, $entries); $this->assertNotNull($err); $this->assertEquals($ret[0]['code'], 200); $this->assertEquals($ret[1]['code'], 612); }
echo "Success! \n"; } # @endgist # @gist entrypath1 $e1 = new Qiniu_RS_EntryPath($bucket, $key1); # @endgist # @gist entrypath2 $e2 = new Qiniu_RS_EntryPath($bucket, $key2); # @endgist # @gist entrypath3 $key3 = $key1 . '3'; $e3 = new Qiniu_RS_EntryPath($bucket, $key3); # @endgist # @gist batch_stat $entries = array($e1, $e2); list($ret, $err) = Qiniu_RS_BatchStat($client, $entries); echo "\n\n====> Qiniu_RS_BatchStat result: \n"; if ($err !== null) { var_dump($err); } else { var_dump($ret); } # @endgist # @gist batch_copy $entryPairs = array(new Qiniu_RS_EntryPathPair($e1, $e2), new Qiniu_RS_EntryPathPair($e1, $e3)); list($ret, $err) = Qiniu_RS_BatchCopy($client, $entryPairs); echo "\n\n====> Qiniu_RS_BatchCopy result: \n"; if ($err !== null) { var_dump($err); } else { var_dump($ret);
public function batchStat() { $keys = func_get_args(); if (func_num_args() <= 0) { return array(); } foreach ($keys as $i => $key) { $keys[$i] = new \Qiniu_RS_EntryPath($this->bucket, $key); } list($ret, $err) = Qiniu_RS_BatchStat($this->client, $keys); if ($err !== null) { $ret['code'] = $err->Code; return $ret; } else { return $ret; } }