這是一個徹頭徹尾的黑客先前設置它,我有完全相同的問題,所以我走進Zend的在/ GDATA/YouTube的/ PlaylistListEntry.php類在線229我註釋了if else語句。
/**
* Returns the Id relating to the playlist.
*
* @throws Zend_Gdata_App_VersionException
* @return Zend_Gdata_YouTube_Extension_PlaylistId The id of this playlist.
*/
public function getPlaylistId()
{
/*if (($this->getMajorProtocolVersion() == null) ||
($this->getMajorProtocolVersion() == 1)) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The yt:playlistId ' .
'element is not supported in versions earlier than 2.');
} else {*/
return $this->_playlistId;
//}
}
我希望有人來告訴我們如何解決這個問題的正確方法,但是這使得它如此
function printPlaylistListEntry($playlistListEntry, $showPlaylistContents = false)
{
$this->yt->setMajorProtocolVersion(2);
echo '<br>Title: ' . $playlistListEntry->title->text . "\n";
echo '<br>Description: ' . $playlistListEntry->description->text . "\n";
echo '<br>playlistId: ' . $playlistListEntry->playlistId->text . "\n";
...(在YouTube V2 PHP API)。
將返回playlistid。
標題:therighttitle
說明:therightdescription
playlistId:therightplaylistId
編輯:我覺得這可能是一個更好的解決方案:
if ($this->getMajorProtocolVersion() < 2) {
require_once 'Zend/Gdata/App/VersionException.php';
throw new Zend_Gdata_App_VersionException('The yt:playlistId ' .
'element is not supported in versions earlier than 2.');
} else {
return $this->_playlistId;
}
用此代替getPlaylistId()函數,遵循前面的getDescription函數的邏輯,以及它的較少哈希。再次完全公開批評爲什麼這是或不是來自zend人的好主意。