1

我的 notify.php 中有这个

   foreach ($request['userActions'] as $i => $user_action) {
        if ($user_action['type'] == 'SHARE') {
            write("SHARE");
            $timeline_item_id = $request['itemId'];

            $timeline_item = $mirror_service->timeline->get($timeline_item_id);

            foreach($timeline_item->getAttachments() as $j => $attachment) {
                write(json_encode($attachment));
              $attachment = $mirror_service->timeline_attachments->get($timeline_item_id, $attachment.getId());
              $bytes = download_attachment($timeline_item_id, $attachment);

              // Insert a new timeline card, with a copy of that photo attached
              $echo_timeline_item = new Google_TimelineItem();
              $echo_timeline_item->setText("Echoing your shared photo");
              $echo_timeline_item->setNotification(
                new google_NotificationConfig(array("level"=>"DEFAULT")));
              insert_timeline_item($mirror_service, $echo_timeline_item, "image/jpeg", $bytes);
              write("ECHO");
            }
            break;
        }
 }

问题是它说

       $attachment = $mirror_service->timeline_attachments->get($timeline_item_id, $attachment.getId());

找不到“.getId()”。

我也有所有必需的文件

require_once 'config.php';
require_once 'mirror-client.php';
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_MirrorService.php';
require_once 'util.php';

有任何想法吗?

4

1 回答 1

2

$attachment.getId()不是有效的 PHP。它应该是

$attachment->getId();

使用.,您正在尝试将$attachment对象与不存在的getId()函数可能返回的任何内容连接起来。

于 2013-07-29T14:50:30.040 回答