javascript和JQuery焦点图和代码特效大全
当前最流行的开源CMS网站系统大全
当前位置:主页 > 编程开发 > PHP编程 >

PHP简单实现web文件分享

来源:IT技术网编辑:素还真发布于:2013-08-22人围观Phpweb实现文件分享

PHP简单实现web文件分享,具体代码如下:

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>private file box</title>
</head>
 
<body>
<h2>private file box</h2>
<?php
function list_file_url() {
exec ( "/bin/ls", $res, $rc );
//echo "<pre>";
// var_dump ( $res );
// var_dump ( $rc );
// echo "</pre>";
 
if (0 == $rc) {
//echo count ( $res ) . "<br />";
//echo "<br />";
 
for($i = 0; $i < count ( $res ); $i ++) {
if ($res[$i] != "index.php") {
//echo $res [$i] . "<br />";
$encoded_url = urlencode($res[$i]);
$encoded_url = str_replace("+","%20",$encoded_url);
$encoded_filename = iconv("utf8","UTF-8",$res[$i]);
                $encoded_temp_filename = explode(".",$encoded_filename);
                $encoded_filename = $encoded_temp_filename[0];   
 
echo "<a href=\"./$encoded_url\">$encoded_filename</a>";
echo "<br />";
echo "<br />";
}
}
}
}
 
list_file_url ();
?>
</body>
 
</html>
 

Php,web,实现,相关的文章
有时间的话来看看IT界的突发事件