0

我正在尝试使用 Podio API 做一些事情,我是初学者。所以我的代码是:

PodioItem::create($app_id, array('fields' => array(
"title" => ($name . " " . $surname),
"adres-e-mail-2" => $email,
), 
array("file_ids" => $file->id) ));

项目创建没有问题,但没有上传文件。错误日志仅抛出弃用:

PHP Deprecated: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead in /home/avat/public_html/avat/aiesec/test/podio/lib/Podio.php on line 179

文件上传脚本正在运行,我可以将其保存到我的文件夹中。我有 Podio 文件 ID 工作。我现在真的不知道在哪里寻找错误。

4

1 回答 1

3

使用对象而不是静态方法几乎总是更容易。至于上传文件,我将下面的示例分成几部分,以便更容易看到发生了什么:

// Upload file
$file = PodioFile::upload("/Users/andreas/Desktop/irwin.jpg", "irwin.jpg");

// Create a new item object
$item = new PodioItem(array(
  'app' => new PodioApp(8018420),
  'fields' => new PodioItemFieldCollection()
));

// Set a value for the field with the external id 'title'
$item->fields['title'] = new PodioTextItemField();
$item->fields['title']->values = $name . " " . $surname;

// Create a new collection for files and add the $file to this collection
$item->files = new PodioCollection(array($file));

// Save the item to Podio
$item->save();

更多信息请访问:

于 2014-06-30T17:27:22.173 回答