Web-based music player demo http://pan.baidu.com/s/1dDgm7HR
I DIYed a mobile online music player demo address http://shanxi2014.com/zhuandizhi/dom.php
Fully supports mobile browsers.
Mainly modify the reference path (do not modify the relative storage address of the file)
The second is the regular splicing parameters
<script src="/city/js/libs/jquery-1.10.2.min.js"></script> <script src="/city/js/libs/jquery-ui.min.js"></script> <script src="/city/js/libs/bootstrap.min.js"></script> <!-- Style CSS --> <link href="/city/css/bootstrap.css" media="screen" rel="stylesheet"> <link href="/city/style.css" media="screen" rel="stylesheet"> <!-- General Scripts --> <script src="/city/js/general.js"></script> <!-- custom input --> <script src="/city/js/jquery.customInput.js"></script> <!-- Placeholders --> <script src="/city/js/jquery.powerful-placeholder.min.js"></script> <script><span> jQuery(document)</span>.ready(<span>function</span><span>($) { </span><span>if</span>($("[placeholder]").size() > 0<span>) { $</span>.Placeholder.<span>init(); } }); </span></script> <!-- CarouFredSel --> <script src="js/jquery.carouFredSel-6.2.1-packed.js"></script> <!-- Lightbox prettyPhoto --> <link href="css/prettyPhoto.css" rel="stylesheet"> <script src="js/jquery.prettyPhoto.js"></script> <!-- Video Player --> <link href="/city/css/video-js.css" rel="stylesheet"> <script src="/city/js/video.js"></script> <script><span> videojs</span>.options.flash.swf = "js/video-js.swf"<span>; </span></script> <!-- Audio Player --> <link href="/city/css/jplayer.css" rel="stylesheet"> <script src="/city/js/jquery.jplayer.min.js"></script> <script src="/city/js/jplayer.playlist.min.js"></script> <script type="text/javascript"> <span>//</span><span><![CDATA[</span> $(document).ready(<span>function</span><span>(){ </span><span>new</span><span> jPlayerPlaylist({ jPlayer</span>: "#jquery_jplayer_1",<span> cssSelectorAncestor</span>: "#jp_container_1"<span> }</span>, [<?php <span>if</span>(<span>strlen</span>(<span>$a</span>[2])>6){<span>foreach</span> (<span>$a</span> <span>as</span> <span>$va</span><span>) { </span><span>echo</span> <span>$tittle</span>.<span>$va</span><span>; };}</span>?><span> {title</span>:"<div class='item-image'><img src='http://www.bkjia.com/uploads/allimg/140519/1213052329-0.jpg' /></div>终于等到你",m4a:"http://cc.stream.qqmusic.qq.com/C100003GF7MY2P0fz7.m4a?fromtag=52"},{title:"<div class='item-image'><img src='http://www.bkjia.com/uploads/allimg/140519/1213052329-0.jpg' /></div>陪你走到底",m4a:"http://cc.stream.qqmusic.qq.com/C100003GX33X2aLY1R.m4a?fromtag=52"},{title:"<div class='item-image'><img src='http://www.bkjia.com/uploads/allimg/140519/1213052329-0.jpg' /></div>如果爱下去",m4a:"http://cc.stream.qqmusic.qq.com/C10000395SnV0rl1hZ.m4a?fromtag=52"},{title:"<div class='item-image'><img src='http://www.bkjia.com/uploads/allimg/140519/1213052329-0.jpg' /></div>天下无双",m4a:"http://cc.stream.qqmusic.qq.com/C100002sjtbA1K4ASF.m4a?fromtag=52"<span>} ]</span>,<span> { swfPath</span>: "js",<span> supplied</span>: "oga, mp3,m4a",<span> wmode</span>: "window",<span> smoothPlayBar</span>: <span>false</span>,<span> keyEnabled</span>: <span>false</span><span> }); }); </span><span>//</span><span>]]></span> </script>
Get the address of Sogou Music
<?<span>php </span><span>$query</span>=<span>$_GET</span>['s'<span>]; </span><span>$q</span>= mb_convert_encoding(<span>$query</span>,"GBK","UTF-8"<span>); </span><span>$ew</span>=<span>urlencode</span>(<span>$query</span><span>); </span><span>$jsrc</span> = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q={<span>$ew</span>}"<span>; </span><span>$json</span> = <span>file_get_contents</span>(<span>$jsrc</span><span>); </span><span>$jset</span> = json_decode(<span>$json</span>, <span>true</span><span>); </span><span>$src</span>=<span>$jset</span>["responseData"]["results"][0]["url"<span>]; </span><span>$image</span>="<div class='item-image'><img src='http://www.bkjia.com/uploads/allimg/140519/1213052329-0.jpg' /></div>"<span>; </span><span>$query</span>=<span>urlencode</span>(<span>$query</span><span>); </span><span>$url</span>="http://mp3.sogou.com/music.so?query={<span>$query</span>}"<span>; </span><span>function</span> curl_get(<span>$url</span>, <span>array</span> <span>$get</span> = <span>NULL</span>, <span>array</span> <span>$options</span> = <span>array</span><span>()) { </span><span>$defaults</span> = <span>array</span><span>( CURLOPT_URL </span>=> <span>$url</span>. (<span>strpos</span>(<span>$url</span>, '?') === <span>FALSE</span> ? '?' : ''). <span>http_build_query</span>(<span>$get</span>),<span> CURLOPT_HEADER </span>=> 0,<span> CURLOPT_RETURNTRANSFER </span>=> <span>TRUE</span>,<span> CURLOPT_TIMEOUT </span>=> 4<span> ); </span><span>$ch</span> =<span> curl_init(); curl_setopt_array(</span><span>$ch</span>, (<span>$options</span> + <span>$defaults</span><span>)); </span><span>if</span>( ! <span>$result</span> = curl_exec(<span>$ch</span><span>)) { </span><span>trigger_error</span>(curl_error(<span>$ch</span><span>)); } curl_close(</span><span>$ch</span><span>); </span><span>return</span> <span>$result</span><span>; } </span><span>$html</span>=curl_get(<span>$url</span>,<span>array</span>(), <span>array</span><span>()); </span><span>iconv</span>("GB2312","UTF-8//IGNORE",<span>$html</span><span>); </span><span>$c</span>="+onclick=\"qqDownload.*http://cc\.stream\.qqmusic\.qq\.com.*\.m4a\?fromtag=52+i"<span>; </span><span>$elemment</span>=<span>$html</span><span>; </span><span>if</span> (<span>preg_match_all</span>(<span>$c</span>, <span>$elemment</span>,<span>$matches</span>)){<span>$i</span>=0<span>; </span><span>$a</span> = <span>array</span><span>(); </span><span>$t</span>=<span>array</span><span>(); </span><span>foreach</span> (<span>$matches</span>[0] <span>as</span> <span>$val</span><span>) { </span><span>$val</span>=<span>explode</span>("@@", <span>$val</span>, 11<span>); </span><span>$t</span>[<span>$i</span>]="<a href=\"{<span>$val</span>[10]}\" class=\"btn btn-red btn-round\"><span >{<span>$val</span>[1]}</span></a><br/>"<span>; </span><span>$i</span>++<span>; </span><span>$val</span>[1]=<span>$image</span>.<span>$val</span>[1<span>]; </span><span>$a</span>[<span>$i</span>]="{title:\"{<span>$val</span>[1]}\",". "m4a:\"{<span>$val</span>[10]}\"},"<span>; } } </span>?>