这是我在这个网站上的第一个问题.我是php的新手但是我已经按照建议尽可能地弄脏了它.不幸的是现在我有点难过这个简单的Youtube应用程序,我正在努力创建.
我知道有几个相关的问题,但我还没有找到一个全面的解决方案来解决我的问题.
无论如何,我要做的是在youtube频道中获取视频的网址,提取视频ID并创建一个数组,然后我可以传递给javascript函数以获得一些很酷的客户端内容.
到目前为止,这是我的代码.我很确定我的问题与数组与字符串以及方法内外的变量有关.在任何情况下,我的array_map函数都不起作用,showFullFeed()函数只返回一个值而不是链接数组.
任何帮助都是很有帮助的.干杯
class ChannelFeed {
function __construct($username) { $this->username=$username; $this->feedUrl=$url='http://gdata.youtube.com/feeds/api/users/'.$username.'/favorites'; $this->feed=simplexml_load_file($url); }
public function getYTid() {
$ytURL = $this->feed->entry->link['href'];
$ytvIDlen = 11; // This is the length of YouTube's video IDs
// The ID string starts after "v=", which is usually right after // "youtube.com/watch?" in the URL $idStarts = strpos($ytURL, "?v=");
// In case the "v=" is NOT right after the "?" (not likely, but I like to …