问题
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