【问题标题】:Zend/Google apps - delete entry - if-match og etag attribute requiredZend/Google 应用程序 - 删除条目 - 需要 if-match og etag 属性
【发布时间】:2012-09-07 19:15:50
【问题描述】:

尝试删除条目时返回错误?

你不应该只是调用delete方法来删除条目吗!?

$this->client = Zend_Gdata_ClientLogin::getHttpClient($this->admin_user, $this->admin_pass, 'cp');
$this->client->setHeaders('If-Match: *');
$this->gdata = new Zend_Gdata($this->client);
$this->gdata->setMajorProtocolVersion(3);

$feed = $gdata->getFeed($query);
foreach($feed as $entry){
    $entry->delete();
}

错误:

ERROR: Expected response code 200, got 403
If-Match or If-None-Match header or entry etag attribute required

【问题讨论】:

    标签: php zend-framework google-apps


    【解决方案1】:

    编辑您的文件 App.php 并在第 538 行附近(至少我的情况),即在函数 prepareRequest() 内部更改:

    if ($method == 'DELETE') {
        $rawData = null;
    }
    

    到这里

    if ($method == 'DELETE') {
        $rawData = null;
        $headers['If-Match'] = '*';
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-27
      • 1970-01-01
      • 1970-01-01
      • 2020-01-06
      相关资源
      最近更新 更多