20,359
社区成员
发帖
与我相关
我的任务
分享
<?php
$url="http://wget.icecms.cn/offline-download-master.zip";
$allow_type = array("wmv","apk","deb","iso","xls","xlsx","exe","cpp","pdf","gif","mp3","mp4","zip","rar","doc","docx","mov","ppt","pptx","txt","7z","jpeg","jpg","JPEG","png");
$torrent = explode(".",$url);
$Suffix = end($torrent);//end()函数将数组内部指针指向最后一个元素,并返回该元素的值(如果成功)
$Suffix = strtolower($Suffix);//函数把字符串转换为小写。
if(in_array($Suffix,$allow_type)){
echo $msg="上传成功,正在后台下载,待会回来看上传结果";
echo shell_exec("wget -b -nc -o /tmp/output.txt --restrict-file-names=nocontrol -P ./download http://wget.icecms.cn/offline-download-master.zip " . escapeshellarg($url));
// echo "wget -b -nc -o /dev/null --restrict-file-names=nocontrol -P ./download " . escapeshellarg($url);
}
else {
echo $msg="请勿上传非法文件或者无效链接";
}
// $a = system("dir",$out);
// print_r($a);
// print_r($out);
?>