我怎么能用php http://elcinema.tv/system/videos/{this id} /sd.flv知道id

时间:2012-03-12 12:40:22

标签: php

例如http://elcinema.tv/system/videos/1796/sd.flv 我想知道什么是id - (1796)使用php

这是全文:

 <div id="flowplayer" style="display: block; width: 620px; height: 465px;"></div>
 <script type="text/javascript">
  //<![CDATA[
 flowplayer('flowplayer', "flowplayer-3.2.8.swf", {
   clip: {
     autoPlay: true,
     autoBuffering: true,
     onMetaData: function(clip) {
       var w = parseInt(clip.metaData.width);
       var h = parseInt(clip.metaData.height);
       f = document.getElementById('flowplayer');
       f.style.width ='620px';
       f.style.height = '465px';
     }
    },
   playlist: [
    'http://elcinema.tv/system/videos/1796/sd.flv'
   ]
 });
 //]]>
 </script>  

1 个答案:

答案 0 :(得分:2)

不需要regexp,试试这个:

$url = 'http://elcinema.tv/system/videos/1796/sd.flv';
$parts = explode('/', $url);
$id = $parts[count($parts)-2];