Home > Article > Backend Development > Simple PHP for web files_PHP tutorial
Very simple, used for file sharing on the web
1 Execute *nix command to obtain the files in this directory
2 Generate download link
3 Supports Chinese names, and the name can contain spaces
4 Please save the source code as utf-8 encoding
5 Assume that the sharing path is http://xx_host/xx_dir, the code is named index.php and placed in the xx_dir directory, and all file download links except index.php are generated
<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 ( "tyncar.com/bin/ls", $res, $rc ); //echo "<pre class="brush:php;toolbar:false">"; // var_dump ( $res ); // var_dump ( $rc ); // echo ""; if (0 == $rc) { //echo count ( $res ) . "