小编Pra*_*har的帖子

对多个 RecyclerView 使用单个 RecyclerView.Adapter

我所做的:我有一个带有 4 个片段的 viewpager,它们膨胀包含 RecyclerView 的相同布局。我为所有片段构建了一个适配器。当我单击一个项目时,它会加载数据并将数据附加到列表并将新数据设置到适配器。

问题:问题是当我更改特定片段的特定 recyclerview 的数据时,更改会对所有 recyclerview 生效。

android android-recyclerview

7
推荐指数
0
解决办法
1541
查看次数

使用 Box.com PHP API 上传文件

我正在尝试使用 Box API 将文件上传到 box.com。根据文档,curl 请求必须如下所示:

curl https://upload.box.com/api/2.0/files/content \
  -H "Authorization: Bearer ACCESS_TOKEN" -X POST \
  -F attributes='{"name":nameOftheFile, "parent":{"id":parentId}}' \
  -F file=@file
Run Code Online (Sandbox Code Playgroud)

这是我所做的:

$token = "......";
$url = https://upload.box.com/api/2.0/files/content;
$file_upload;

foreach ($_FILES['file']['name'] as $position => $file) { 
    $file_upload = $_FILES['file']['tmp_name'][$position];
}
$json  = json_encode(array('name' => $file ,array('parent' => array('id' => 0))));
$attrs = array('attributes' => $json,'file'=>'@'.$file_upload);

$this->post($url,($attrs));

// Post function
function post($url,$fields){
    try {       
        $ch = curl_init();          
        curl_setopt($ch,CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Authorization: Bearer '.$this->token
        ));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);          
        curl_setopt($ch, …
Run Code Online (Sandbox Code Playgroud)

php curl box-api boxapiv2

5
推荐指数
1
解决办法
2594
查看次数

标签 统计

android ×1

android-recyclerview ×1

box-api ×1

boxapiv2 ×1

curl ×1

php ×1