1.代码调试
(1) die("debug information");
(2) file_put_contents("D:/mylogs.txt",$var);
(3)【抓包】通过浏览器开发人员工具(F12)-> 网络(Network)找到被请求的php文件
2.windows/linux通用拆分,且扩展性很强。
<?php
/*
function mydownload($str){
str_replace("\r\n","\n",$str);
$arr1=explode("\n",$str);
$arr3=array();
foreach($arr1 as $k1=>$val1){
$arr2=explode("|",$val1);
$arr3[$arr2[0]][]=array(
'title'=>$arr2[1],
'fbl'=>$arr2[2],
'url'=>$arr2[3]
);
}
echo "<pre>";
print_r($arr3);
echo "</pre>";
}
*/
$str="3gp|导火线01|176x144|http://www.xunlei.com/01.3gp
3gp|导火线02|176x144|http://www.xunlei.com/02.3gp
3gp|导火线03|176x144|http://www.xunlei.com/03.3gp
mp4|导火线01|256x400|http://www.xunlei.com/01.mp4
mp4|导火线02|256x400|http://www.xunlei.com/02.mp4";
str_replace("\r\n","\n",$str);
$arr1=explode("\n",$str);
$arr3=array();
foreach($arr1 as $k1=>$val1){
$arr2=explode("|",$val1);
$arr3[$arr2[0]][]=array(
'title'=>$arr2[1],
'fbl'=>$arr2[2],
'url'=>$arr2[3]
);
}
echo "<pre>";
print_r($arr3);
echo "</pre>";
?>