【问题标题】:Get file id to get file from item - Podio API获取文件 ID 以从项目中获取文件 - Podio API
【发布时间】:2018-05-28 15:31:09
【问题描述】:

所以我想从我的项目中获取文件并将其保存到我的服务器,但我似乎无法从项目中获取文件 ID。我该怎么做?当我通过 PodioItem 查看项目详细信息时:获取我仅获取的文件详细信息是:

 [files] => Array
                (
                    [type] => File
                    [options] => Array
                        (
                            [json_value] => file_id
                            [json_target] => file_ids
                        )

            )

我想知道如何获取项目的文件ID,然后我打算使用PodioFile::get_raw( $file_id ); 代码来获取文件

非常感谢您的帮助

【问题讨论】:

    标签: podio


    【解决方案1】:

    您可以使用 API 获取物品

     $item = PodioItem::get($itemID);
    

    此外,您可以使用 $item->files 获取附加到项目的文件

     if ($item->files && count($item->files) > 0) {
            foreach ($item->files as $fileID) {
                $file = PodioFile::get($fileID);
                $fileRaw = $file->get_raw();
                // save the file 
                file_put_contents($yourPathToSaveFile, $fileRaw);// make sure you have permission to save the file to the location
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多