2009-08-25 4 views
1

아래는 $ x (youtube video) 변수의 덤프입니다.

는하지만 미디어 $ 제목에 액세스하려면,하지만 분명히 나는 ​​$ x 축

이> 미디어 $ 타이틀하려고 할 때 -> $ (t)가

가 작동하지 않습니다. YouTube 동영상의 제목에 액세스하는 방법에 대한 제안 사항이 있으십니까?

stdClass Object (

[version] => 1.0 
[encoding] => UTF-8 

[entry] => stdClass Object ([xmlns] => http://www.w3.org/2005/Atom [xmlns$media] => http://search.yahoo.com/mrss/ [xmlns$gd] => http://schemas.google.com/g/2005 [xmlns$yt] => http://gdata.youtube.com/schemas/2007 [id] => stdClass Object ([$t] => http://gdata.youtube.com/feeds/api/videos/OQ14NjbEXJM) [published] => stdClass Object ([$t] => 2006-10-01T23:21:06.000Z) [updated] => stdClass Object ([$t] => 2009-08-25T07:34:28.000Z) [category] => Array ([0] => stdClass Object ([scheme] => http://schemas.google.com/g/2005#kind [term] => http://gdata.youtube.com/schemas/2007#video) [1] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/categories.cat [term] => Howto [label] => Howto & Style) [2] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/keywords.cat [term] => tutorial) [3] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/keywords.cat [term] => php) [4] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/keywords.cat [term] => sql) [5] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/keywords.cat [term] => mysql) [6] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/keywords.cat [term] => phpmyadmin) [7] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/keywords.cat [term] => lgo666) [8] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/keywords.cat [term] => computers) [9] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/keywords.cat [term] => video) [10] => stdClass Object ([scheme] => http://gdata.youtube.com/schemas/2007/keywords.cat [term] => sexy)) [title] => stdClass Object ([$t] => PHP Tutorial // User Registration w/ SQL [type] => text) [content] => stdClass Object ([$t] => PLEASE CHECK OUT THE SECOND VIDEO OF THIS A quick and easy user registration using php, sql and phpmyadmin. For full size and source codes: http://www.neoblob.com/phpsquad/tuts/php/1/ SQL: CREATE TABLE `user` (`id` int(10) unsigned NOT NULL auto_increment, `username` varchar(20) NOT NULL default '', `password` varchar(50) NOT NULL default '', `email` varchar(40) NOT NULL default '', `ip` varchar(20) NOT NULL default '', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; [type] => text) [link] => Array ([0] => stdClass Object ([rel] => alternate [type] => text/html [href] => http://www.youtube.com/watch?v=OQ14NjbEXJM) [1] => stdClass Object ([rel] => http://gdata.youtube.com/schemas/2007#video.responses [type] => application/atom+xml [href] => http://gdata.youtube.com/feeds/api/videos/OQ14NjbEXJM/responses) [2] => stdClass Object ([rel] => http://gdata.youtube.com/schemas/2007#video.related [type] => application/atom+xml [href] => http://gdata.youtube.com/feeds/api/videos/OQ14NjbEXJM/related) [3] => stdClass Object ([rel] => http://gdata.youtube.com/schemas/2007#mobile [type] => text/html [href] => http://m.youtube.com/details?v=OQ14NjbEXJM) [4] => stdClass Object ([rel] => self [type] => application/atom+xml [href] => http://gdata.youtube.com/feeds/api/videos/OQ14NjbEXJM)) [author] => Array ([0] => stdClass Object ([name] => stdClass Object ([$t] => lifeg0eson666) [uri] => stdClass Object ([$t] => http://gdata.youtube.com/feeds/api/users/lifeg0eson666))) [gd$comments] => stdClass Object ([gd$feedLink] => stdClass Object ([href] => http://gdata.youtube.com/feeds/api/videos/OQ14NjbEXJM/comments [countHint] => 365)) [media$group] => stdClass Object ([media$category] => Array ([0] => stdClass Object ([$t] => Howto [label] => Howto & Style [scheme] => http://gdata.youtube.com/schemas/2007/categories.cat)) [media$content] => Array ([0] => stdClass Object ([url] => http://www.youtube.com/v/OQ14NjbEXJM&f=videos&app=youtube_gdata [type] => application/x-shockwave-flash [medium] => video [isDefault] => true [expression] => full [duration] => 980 [yt$format] => 5) [1] => stdClass Object ([url] => rtsp://rtsp2.youtube.com/CiILENy73wIaGQmTXMQ2NngNORMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp [type] => video/3gpp [medium] => video [expression] => full [duration] => 980 [yt$format] => 1) [2] => stdClass Object ([url] => rtsp://rtsp2.youtube.com/CiILENy73wIaGQmTXMQ2NngNORMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp [type] => video/3gpp [medium] => video [expression] => full [duration] => 980 [yt$format] => 6)) [media$description] => stdClass Object ([$t] => PLEASE CHECK OUT THE SECOND VIDEO OF THIS A quick and easy user registration using php, sql and phpmyadmin. For full size and source codes: http://www.neoblob.com/phpsquad/tuts/php/1/ SQL: CREATE TABLE `user` (`id` int(10) unsigned NOT NULL auto_increment, `username` varchar(20) NOT NULL default '', `password` varchar(50) NOT NULL default '', `email` varchar(40) NOT NULL default '', `ip` varchar(20) NOT NULL default '', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; [type] => plain) [media$keywords] => stdClass Object ([$t] => tutorial, php, sql, mysql, phpmyadmin, lgo666, computers, video, sexy) [media$player] => Array ([0] => stdClass Object ([url] => http://www.youtube.com/watch?v=OQ14NjbEXJM)) [media$thumbnail] => Array ([0] => stdClass Object ([url] => http://i.ytimg.com/vi/OQ14NjbEXJM/2.jpg [height] => 90 [width] => 120 [time] => 00:08:10) [1] => stdClass Object ([url] => http://i.ytimg.com/vi/OQ14NjbEXJM/1.jpg [height] => 90 [width] => 120 [time] => 00:04:05) [2] => stdClass Object ([url] => http://i.ytimg.com/vi/OQ14NjbEXJM/3.jpg [height] => 90 [width] => 120 [time] => 00:12:15) [3] => stdClass Object ([url] => http://i.ytimg.com/vi/OQ14NjbEXJM/0.jpg [height] => 240 [width] => 320 [time] => 00:08:10)) [media$title] => stdClass Object ([$t] => PHP Tutorial // User Registration w/ SQL [type] => plain) [yt$duration] => stdClass Object ([seconds] => 980)) [gd$rating] => stdClass Object ([average] => 3.8587787 [max] => 5 [min] => 1 [numRaters] => 262 [rel] => http://schemas.google.com/g/2005#overall) [yt$statistics] => stdClass Object ([favoriteCount] => 549 [viewCount] => 144308))) 

답변

7

당신이 (등, 즉 $ 기호뿐만 아니라 공간) 잘못된 문자를 사용하는 PHP 객체의 멤버에 액세스해야하는 경우

$x->{'media$title'}->{'$t'} 

을 시도, 당신은 $의 OBJ 할 수 있습니다 -> { '회원 이름'} 속임수로 액세스하십시오.

+0

감사합니다. .... 나는 그 사실을 알고 있습니다. :) –

+0

큰 따옴표를 사용해서는 안됩니다. @ "{$ t"} – inakiabt

+0

@inakiabt : 큰 따옴표는 PHP가''$ title "'을'$ title'의 내용으로 바꾸도록 시도합니다. 대/소문자가 null 일 수 있습니다. 작은 따옴표를 사용하면'$'를 벗어날 필요가 없으며 변수 치환이 아니라 문자열을 문자 그대로 해석하도록 PHP에 지시합니다. – dcousineau