シンプルな PHP Web ファイル共有
gt
lt
quot
非常にシンプルで、ウェブ上でファイルを共有するために使用されます
1 *nix コマンドを実行して、このディレクトリ内のファイルを取得します
2 ダウンロードリンクを生成
3 中国語の名前をサポートし、名前にはスペースを含めることができます
4 ソースコードを utf-8 エンコードで保存してください
5 共有パスが http://xx_host/xx_dir で、コードの名前がindex.php で xx_dir ディレクトリに配置され、index.php を除くすべてのファイル ダウンロード リンクが生成されると仮定します
<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 class="brush:php;toolbar:false">"; // var_dump ( $res ); // var_dump ( $rc ); // echo ""; if (0 == $rc) { //echo count ( $res ) . "
"; //echo "
"; for($i = 0; $i < count ( $res ); $i ++) { if ($res[$i] != "index.php") { //echo $res [$i] . "
"; $encoded_url = urlencode($res[$i]); $encoded_url = str_replace("+","%20",$encoded_url); $encoded_filename = iconv("GBK","UTF-8",$res[$i]); $encoded_temp_filename = explode(".",$encoded_filename); $encoded_filename = $encoded_temp_filename[0]; echo "$encoded_filename"; echo "
"; echo "
"; } } } } list_file_url (); ?>