{"id":283,"date":"2014-12-01T17:39:21","date_gmt":"2014-12-01T17:39:21","guid":{"rendered":"http:\/\/www.nywzjs.com\/?p=283"},"modified":"2014-12-01T17:39:21","modified_gmt":"2014-12-01T17:39:21","slug":"phpcms%e5%a2%9e%e5%8a%a0%e9%9f%b3%e4%b9%90%e6%92%ad%e6%94%be%e6%a8%a1%e5%9d%97","status":"publish","type":"post","link":"http:\/\/www.nywzjs.com\/?p=283","title":{"rendered":"PHPCMS\u589e\u52a0\u97f3\u4e50\u64ad\u653e\u6a21\u5757"},"content":{"rendered":"<p>1\u3001\u65b0\u5efa\u6a21\u578b\uff0c\u6a21\u578b\u540d\u79f0\u201c\u97f3\u4e50\u6a21\u578b\u201d\uff0c\u6570\u636e\u8868\u201cmusic\u201d\u3002<br \/>\n\u5728\u5b57\u6bb5\u7ba1\u7406\u91cc\uff0c\u65b0\u5efa\u6b4c\u5531\u5bb6\u7b80\u4ecb\u3001\u97f3\u4e50\u6587\u4ef6\u5b57\u6bb5\uff0c\u4fee\u6539\u4f5c\u8005\u5b57\u6bb5\u540d\u4e3a\u6b4c\u5531\u5bb6\uff0c\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u589e\u52a0\u66f4\u591a\u7684\u5b57\u6bb5\u3002<br \/>\n\u6b4c\u5531\u5bb6\u7b80\u4ecb\u4e3a\u6587\u672c\u7c7b\u578b\uff0c\u97f3\u4e50\u6587\u4ef6\u5b57\u6bb5\u4e3a\u591a\u6587\u4ef6\u4e0a\u4f20\u578b\u3002\u9650\u5236\u6587\u4ef6\u4e2a\u6570\u4e3a1\uff0c\u6587\u4ef6\u7c7b\u578b\u4e3amp3,wma\u7b49\u3002<\/p>\n<p>\u8fd9\u91cc\u7684\u6570\u636e\u8868\u6839\u636e\u4f60\u81ea\u5df1\u7684\u9700\u8981\uff0c\u4e5f\u53ef\u4ee5\u6309Music\u8d70\uff0c\u6211\u540e\u8fb9\u7684\u4f8b\u5b50\u5168\u662fmusic\u3002<\/p>\n<p>2\u3001\u65b0\u5efa\u680f\u76ee\uff0c\u53ef\u4ee5\u4ee5\u8be5\u680f\u76ee\u65b0\u521b\u5efalist\u548cShow\u9875\u9762\u7684\u6a21\u677f\uff0c\u6211\u505a\u7684\u662flist_music.html\u548cshow_music.html\u3002<\/p>\n<p>3\u3001\u5728\u81ea\u5df1\u7684JS\u5e93\u91cc\u589e\u52a0\u4e00\u4e2a\u51fd\u6570<\/p>\n<blockquote><p>\/\/\u5168\u9009\u53cd\u9009<br \/>\nfunction SelectAll(inputname) {<br \/>\nvar checkboxs=document.getElementsByName(inputname);<br \/>\nfor (var i=0;i&lt;checkboxs.length;i++) {<br \/>\nvar e=checkboxs[i];<br \/>\ne.checked=!e.checked;<br \/>\n}<br \/>\n}<\/p><\/blockquote>\n<p>4\u3001\u65b0\u5efa\u4e00\u4e2a\u97f3\u4e50\u64ad\u653e\u9875\u9762\uff0c\u8fd9\u91cc\uff0c\u63a8\u8350\u4e0b\u9762\u7684\u64ad\u653e\u5668\uff0c\u4e0b\u9762\u7684\u5b9e\u4f8b\u4e5f\u4ee5\u8fd9\u6b3e\u64ad\u653e\u5668\u4e3a\u4f8b\u3002<\/p>\n<p>\u5177\u4f53\u7684\u680f\u76ee\u4e0d\u505a\u8bf4\u660e\u3002\u5728\u5b9e\u4f8b\u4e2d\uff0c\u6211\u5c06\u64ad\u653e\u5668\u539f\u6765\u7684script.js\u6587\u4ef6\u5185\u5bb9\u5185\u7f6e\u5230\u64ad\u653e\u9875\u9762\u4e2d\u3002<\/p>\n<p>\u5728\u5b9e\u9645\u4e2d\u8981\u4fee\u6539\u64ad\u653e\u6570\u636e\u4f4d\u7f6e\u7684\u4ee3\u7801\uff0c\u4fee\u6539\u540e\u7684\u5185\u5bb9\u4e3a\uff1a<\/p>\n<blockquote><p>{loop $music $m}<br \/>\n&lt;?php<br \/>\n$filename = preg_replace(\"\/&lt;a href='(.*)'&gt;(.*)&lt;\\\/a&gt;\/iUs\",'\\\\2',$m);<br \/>\n$fileurl = preg_replace(\"\/&lt;a href='(.*)'(.*)&lt;\\\/a&gt;\/iUs\",'\\\\1',$m);<br \/>\n?&gt;<br \/>\n{<br \/>\ntitle: '{$title}',<br \/>\nartist: '{$author}',<br \/>\nalbum: '{$filename}',<br \/>\n{if $thumb}cover: '{$thumb}',{else}cover: '{IMG_PATH}fxw\/musicnull.jpg',{\/if}<br \/>\nmp3: '{$fileurl}',<br \/>\nogg: ''<br \/>\n},<br \/>\n{\/loop}<\/p><\/blockquote>\n<p>\u529f\u80fd\u4e0d\u518d\u8bf4\u660e\uff0c\uff0c\u770b\u61c2\u8fd9\u4e2a\u64ad\u653e\u5668\u5c31\u5f88\u7b80\u5355\u4e86\uff0c\uff0c\uff0c<\/p>\n<p>\u4e0a\u8ff0\u7684{IMG_PATH}fxw\/musicnull.jpg\uff0c\u662f\u5f53\u6ca1\u6709\u9898\u56fe\u7684\u65f6\u5019\uff0c\u8c03\u7528\u4e00\u4e2a\u9ed8\u8ba4\u7684\u9898\u56fe\u3002<\/p>\n<p>\u81f3\u6b64\uff0c\u5982\u679c\u5355\u64ad\u653e\u7684\u8bdd\uff0c\u8fd9\u5c31\u5b8c\u4e86\uff0c\uff0c<\/p>\n<p>\u5982\u679c\u8981\u64ad\u653e\u5217\u8868\u7684\u8bdd\uff0c\u6309\u4ee5\u4e0b\u4fee\u6539\uff0c\uff0c\uff0c<\/p>\n<p>\u5148\u8bf4\u4e0b\u601d\u8def\uff0c\u4e3b\u8981\u5c31\u662f\u901a\u8fc7\u8868\u5355\u65b9\u5f0f\uff0c\u628a\u8981\u64ad\u653e\u7684\u9879\u76eeID\u901a\u8fc7POST\u65b9\u5f0f\u4f20\u9012\u5230\u64ad\u653e\u9875\u9762\uff0c\u7136\u540e\u64ad\u653e\u9875\u9762\u518d\u901a\u8fc7Get\u6765\u8bfb\u53d6\u9879\u76ee\u5185\u5bb9\uff0c\u8fdb\u800c\u5b8c\u6210\u5217\u8868\u64ad\u653e\u64cd\u4f5c\u3002<\/p>\n<p>5\u3001\u5148\u521b\u5efa\u4e00\u4e2a\u5217\u8868\u64ad\u653e\u7684\u9875\u9762\uff0c\u6253\u5f00\\phpcms\\modules\\content\\index.php\uff0c\u5728\u540e\u9762\u52a0\u4e00\u4e2a\u51fd\u6570\uff0c\u5185\u5bb9\u4e3a\uff1a<\/p>\n<blockquote><p>\/\/\u97f3\u4e50\u5217\u8868\u9875<br \/>\npublic function musiclist() {<br \/>\ninclude template('content','show_music');<br \/>\n}<\/p><\/blockquote>\n<p>\u5c31\u8fd9\u4e48\u7b80\u5355\uff0c\uff0c\uff0c\uff0c\uff0c\u4e0d\u8fc7\uff0c\u6709\u4e86\u8fd9\u4e48\u4e2a\u4fee\u6539\uff0c\u4ee5\u540e\u5347\u7ea7\u7684\u65f6\u5019\u8981\u6ce8\u610f\u4e86\uff0c\uff0c\uff0c<\/p>\n<p>6\u3001\u5236\u4f5c\u8868\u5355\u4e86\uff0c\u6253\u5f00list_music.html\uff0c\u5728\u5185\u5bb9\u5217\u8868\u5408\u9002\u4f4d\u7f6e\u52a0\u4e0a<\/p>\n<blockquote><p>&lt;form action=\"{APP_PATH}index.php?m=content&amp;c=index&amp;a=musiclist\" method=\"post\" target=\"_blank\"&gt;<\/p>\n<p>&lt;\/form&gt;<\/p><\/blockquote>\n<p>\u8fd9\u4e2a\u529f\u80fd\u4e0d\u89e3\u91ca\u4e86\uff0c<\/p>\n<p>\u5728\u5408\u9002\u4f4d\u7f6e\u524d\u52a0\u4e0a<\/p>\n<blockquote><p>&lt;input name=\"listid[]\" type=\"checkbox\" value=\"{$r[id]}\" \/&gt;<\/p><\/blockquote>\n<p>\u4e0b\u9762\u662f\u63d0\u4ea4\u548c\u5168\u9009\u7684\u4ee3\u7801<\/p>\n<blockquote><p>&lt;div class=\"musiclistbutton\"&gt;&lt;input name=\"\" type=\"button\" onclick=\"SelectAll('listid[]')\" value=\"\u5168\u9009\/\u53cd\u9009\" \/&gt;<br \/>\n&lt;input name=\"\" type=\"submit\" value=\"\u5f00\u59cb\u8fde\u64ad\" \/&gt;&lt;\/div&gt;<\/p><\/blockquote>\n<p>\u8fd9\u6837\u505a\u8fd9\u4e00\u6b65\u5c31\u5b8c\u4e86\uff0c\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u5728\u4e00\u4e2a\u9875\u9762\u521b\u5efa\u591a\u4e2a\uff0c\u5206\u5757\u5206\u533a\uff0c\u6216\u8005\u522b\u7684\u4ec0\u4e48\u6548\u679c\u90fd\u884c\uff0c\uff0c\uff0c<\/p>\n<p>7\u3001\u56e0\u4e3a\u6211\u4eec\u4e0a\u9762\u8c03\u7528\u7684\u6a21\u677f\u8fd8\u662fshow_music.html\uff0c\u6240\u4ee5\uff0c\u8fd9\u4e2a\u9875\u9762\u5c31\u8981\u518d\u505a\u4e00\u4e9b\u4fee\u6539\u4e86\u3002<\/p>\n<p>\u5c06\u7b2c4\u6b65\u7684\u4ee3\u7801\u4fee\u6539\u4e3a\uff1a<\/p>\n<blockquote><p>{if $_GET[\"a\"] == \"musiclist\"}<br \/>\n&lt;?php<br \/>\nforeach($_POST[\"listid\"] AS $m){<br \/>\nif ($listid){<br \/>\n$listid = $listid . \",\" .$m;<br \/>\n}else{<br \/>\n$listid=$m;<br \/>\n}<br \/>\n}<br \/>\n$listsql=\"SELECT * FROM v9_music_data WHERE id IN(\". $listid . \")ORDER BY id ASC\";<br \/>\n?&gt;<br \/>\n{pc:get sql=\"$listsql\"}<br \/>\n{loop $data $l}<br \/>\n{php eval(\"\\$file=\" . $l[music] . \";\");}<br \/>\n{php $listsql_title = \"SELECT title,thumb FROM v9_music WHERE id=\". $l['id'];}<br \/>\n{pc:get sql=\"$listsql_title\"}<br \/>\n{loop $data $mt}<br \/>\n{<br \/>\ntitle: '{$mt[\"title\"]}',<br \/>\nartist: '{$l[\"author\"]}',<br \/>\nalbum: '{$file[0]['filename']}',<br \/>\n{if $mt[\"thumb\"]}cover: '{$mt[\"thumb\"]}',{else}cover: '{IMG_PATH}fxw\/musicnull.jpg',{\/if}<br \/>\nmp3: '{$file[0]['fileurl']}',<br \/>\nogg: ''<br \/>\n},<br \/>\n{\/loop}<br \/>\n{\/pc}<br \/>\n{\/loop}<br \/>\n{\/pc}<br \/>\n{else}<br \/>\n<span style=\"color: #999999;\">{loop $music $m}<\/span><br \/>\n<span style=\"color: #999999;\"> &lt;?php<\/span><br \/>\n<span style=\"color: #999999;\"> $filename = preg_replace(\"\/&lt;a href='(.*)'&gt;(.*)&lt;\\\/a&gt;\/iUs\",'\\\\2',$m);<\/span><br \/>\n<span style=\"color: #999999;\"> $fileurl = preg_replace(\"\/&lt;a href='(.*)'(.*)&lt;\\\/a&gt;\/iUs\",'\\\\1',$m);<\/span><br \/>\n<span style=\"color: #999999;\"> ?&gt;<\/span><br \/>\n<span style=\"color: #999999;\">{<\/span><br \/>\n<span style=\"color: #999999;\"> title: '{$title}',<\/span><br \/>\n<span style=\"color: #999999;\"> artist: '{$author}',<\/span><br \/>\n<span style=\"color: #999999;\"> album: '{$filename}',<\/span><br \/>\n<span style=\"color: #999999;\"> {if $thumb}cover: '{$thumb}',{else}cover: '{IMG_PATH}fxw\/musicnull.jpg',{\/if}<\/span><br \/>\n<span style=\"color: #999999;\"> mp3: '{$fileurl}',<\/span><br \/>\n<span style=\"color: #999999;\"> ogg: ''<\/span><br \/>\n<span style=\"color: #999999;\"> },<\/span><br \/>\n<span style=\"color: #999999;\"> {\/loop}<\/span><br \/>\n{\/if}<\/p><\/blockquote>\n<p>\u4ee3\u7801\u4e3a\u7070\u8272\u7684\u662f\u7b2c4\u6b65\u4e2d\u7684\u5185\u5bb9\uff0c\u5176\u4f59\u7684\u4e3a\u65b0\u52a0\u5185\u5bb9\u3002\u4ee3\u7801\u4e0d\u4e00\u4e00\u89e3\u91ca\uff0c\uff0c\uff0c<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u5c31\u5b8c\u6210\u4e86\u3002<\/p>\n<p>\u53ef\u4ee5\u5b9e\u73b0\u8fde\u64ad\uff0c\u5355\u4e2a\u64ad\u653e\uff0c\uff0c\u7136\u540e\uff0c\u97f3\u4e50\u6a21\u578b\u5c31\u8fd9\u4e9b\u5185\u5bb9\u5427\uff0c\uff0c\uff0c<\/p>\n<p>\u6536\u85cf\u3001\u6b4c\u8bcd\u8fd9\u4e9b\u529f\u80fd\uff0c\u6ca1\u60f3\u8fc7\uff0c\uff0c\uff0c\uff0c<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.nywzjs.com\/wp-content\/uploads\/2014\/12\/bofangqi.zip\">\u64ad\u653e\u5668\u6587\u4ef6<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u65b0\u5efa\u6a21\u578b\uff0c\u6a21\u578b\u540d\u79f0\u201c\u97f3\u4e50\u6a21\u578b\u201d\uff0c\u6570\u636e\u8868\u201cmusic\u201d\u3002 \u5728\u5b57\u6bb5\u7ba1\u7406\u91cc\uff0c\u65b0\u5efa\u6b4c\u5531\u5bb6\u7b80\u4ecb\u3001\u97f3\u4e50\u6587\u4ef6\u5b57\u6bb5\uff0c\u4fee\u6539\u4f5c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":285,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,13],"tags":[79,86],"_links":{"self":[{"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=\/wp\/v2\/posts\/283"}],"collection":[{"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=283"}],"version-history":[{"count":0,"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=\/wp\/v2\/posts\/283\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=\/wp\/v2\/media\/285"}],"wp:attachment":[{"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nywzjs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}