从响应对象访问 created_on - 获取文件操作 PODIO API
Access created_on from response object - get file action PODIO API
大家好,我正在尝试使用下面的代码访问 created_on
对象,但它不起作用,我得到的日期 January 1, 1970 12:00
不正确。也试过
$item = PodioItem::get($item_id);
$file_id = "";
$created_on = "";
foreach ($item->files as $file) {
echo date('F j, Y h:i',strtotime($file->created_on))."<br>";
}
下面是来自 print_r($file,true)
的响应对象,我可以像 $file->file_id, $file->link
一样毫无问题地访问另一个对象。我想要完成的是将 created_on 数据存储在一个变量中,然后创建一个函数来检查和获取最新日期,然后获取它的 file_id
。
PodioFile Object
[__attributes:PodioObject:private] => Array
(
[file_id] => 464714088
[link] => https://files.podio.com/464714088
[perma_link] =>
[thumbnail_link] =>
[hosted_by] => podio
[name] => KEjj4UQSUV.PDF
[description] =>
[mimetype] => application/pdf
[size] => 785849
[created_on] => 2017-12-08 23:03:36
[rights] => Array
(
[0] => download
[1] => view
[2] => delete
[3] => update
)
PodioFile Object
(
[__attributes:PodioObject:private] => Array
(
[file_id] => 464716575
[link] => https://files.podio.com/464716575
[perma_link] =>
[thumbnail_link] =>
[hosted_by] => podio
[name] => IiaCfJjwws.PDF
[description] =>
[mimetype] => application/pdf
[size] => 785849
[created_on] => 2017-12-08 23:15:30
[rights] => Array
(
[0] => download
[1] => view
[2] => delete
[3] => update
)
PodioFile Object
(
[__attributes:PodioObject:private] => Array
(
[file_id] => 464728331
[link] => https://files.podio.com/464728331
[perma_link] =>
[thumbnail_link] =>
[hosted_by] => podio
[name] => g6cmAeUCiV.PDF
[description] =>
[mimetype] => application/pdf
[size] => 785849
[created_on] => 2017-12-08 23:49:15
[rights] => Array
(
[0] => download
[1] => view
[2] => delete
[3] => update
)
幸运地在此处提供的示例中找到了答案 - https://hotexamples.com/examples/-/PodioItem/filter/php-podioitem-filter-method-examples.html
date_format($file->created_on, 'Y/m/d H:i:s')
成功了
大家好,我正在尝试使用下面的代码访问 created_on
对象,但它不起作用,我得到的日期 January 1, 1970 12:00
不正确。也试过
$item = PodioItem::get($item_id);
$file_id = "";
$created_on = "";
foreach ($item->files as $file) {
echo date('F j, Y h:i',strtotime($file->created_on))."<br>";
}
下面是来自 print_r($file,true)
的响应对象,我可以像 $file->file_id, $file->link
一样毫无问题地访问另一个对象。我想要完成的是将 created_on 数据存储在一个变量中,然后创建一个函数来检查和获取最新日期,然后获取它的 file_id
。
PodioFile Object
[__attributes:PodioObject:private] => Array
(
[file_id] => 464714088
[link] => https://files.podio.com/464714088
[perma_link] =>
[thumbnail_link] =>
[hosted_by] => podio
[name] => KEjj4UQSUV.PDF
[description] =>
[mimetype] => application/pdf
[size] => 785849
[created_on] => 2017-12-08 23:03:36
[rights] => Array
(
[0] => download
[1] => view
[2] => delete
[3] => update
)
PodioFile Object
(
[__attributes:PodioObject:private] => Array
(
[file_id] => 464716575
[link] => https://files.podio.com/464716575
[perma_link] =>
[thumbnail_link] =>
[hosted_by] => podio
[name] => IiaCfJjwws.PDF
[description] =>
[mimetype] => application/pdf
[size] => 785849
[created_on] => 2017-12-08 23:15:30
[rights] => Array
(
[0] => download
[1] => view
[2] => delete
[3] => update
)
PodioFile Object
(
[__attributes:PodioObject:private] => Array
(
[file_id] => 464728331
[link] => https://files.podio.com/464728331
[perma_link] =>
[thumbnail_link] =>
[hosted_by] => podio
[name] => g6cmAeUCiV.PDF
[description] =>
[mimetype] => application/pdf
[size] => 785849
[created_on] => 2017-12-08 23:49:15
[rights] => Array
(
[0] => download
[1] => view
[2] => delete
[3] => update
)
幸运地在此处提供的示例中找到了答案 - https://hotexamples.com/examples/-/PodioItem/filter/php-podioitem-filter-method-examples.html
date_format($file->created_on, 'Y/m/d H:i:s')
成功了