网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的范文:

 

标题 php实现使用优酷土豆视频地址获取swf播放器分享地址
范文
    项目用到临时写的。待完善:
    代码如下:
    /*
    * 根据用户提交的(swf/html)地址,获取优酷,土豆的swf播放地址
    * */
    private function _getswf ($url = '') {
    if(isset($url) && !empty($url)){
    preg_match_all('/http:\/\/(.*?)?\.(.*?)?\.com\/(.*)/',$url,$types);
    }else{
    return false;
    }
    $type = $types[2][0];
    $domain = $types[1][0];
    $isswf = strpos($types[3][0], 'v.swf') === false ? false : true;
    $method = substr($types[3][0],0,1);
    switch ($type){
    case 'youku' :
    if( $domain == 'player' ) {
    $swf = $url;
    }else if( $domain == 'v' ) {
    preg_match_all('/http:\/\/v\.youku\.com\/v_show\/id_(.*)?\.html/',$url,$url_array);
    $swf = '/uploads/202504/02/webhome2826 = $url;
    }
    break;
    case 'tudou' :
    if($isswf){
    $swf = $url;
    }else{
    $method = $method == 'p' ? 'v' : $method ;
    preg_match_all('/http:\/\/www.tudou\.com\/(.*)?\/(.*)?/',$url,$url_array);
    $str_arr = explode('/',$url_array[1][0]);
    $count = count($str_arr);
    if($count == 1) {
    $id = explode('.',$url_array[2][0])[0];
    }else if($count == 2){
    $id = $str_arr[1];
    }else if($count == 3){
    $id = $str_arr[2];
    }
    $swf = '/uploads/202504/02/2827 :
    $swf = $url;
    break;
    }
    return $swf;
    }
随便看

 

在线学习网范文大全提供好词好句、学习总结、工作总结、演讲稿等写作素材及范文模板,是学习及工作的有利工具。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/18 6:12:06