How do I get a youtube video ID (PHP) [closed]

霸气de小男生 提交于 2019-12-18 16:57:52

问题


Given a link from youtube
e.g. http://www.youtube.com/watch?v=XHs99iVpnXU

how do I extract the video id (the v parameter) without it being affected by other parameters such as feature=
e.g. http://www.youtube.com/watch?v=XHs99iVpnXU&feature=watch&fullscrenn=true ?


回答1:


parse_str(parse_url($url, PHP_URL_QUERY), $variables)
print $variables['v'];


来源:https://stackoverflow.com/questions/9522868/how-do-i-get-a-youtube-video-id-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!