Small file php + SQLite storage solution. The number of files on the virtual hosts purchased by our grassroots webmaster is usually limited. a large number of small files occupy a large amount of resources, and Douban is recommended in outdated vertices, however, for hosts, the number of files on the virtual hosts purchased by our grassroots webmaster is usually limited. a large number of small files occupy a large amount of resources, and Douban is recommended in the outdated essence area, however, you must have the host permission. I can only install another idea and use php + SQLite to solve the problem. after my tests, it is practical and recommended to you now.
Public Code now:
Create a database file: php1.php
The code is as follows:
$ Db = new SQLite3 ('mysqlitedb. db ');
// Obtain the binary stream of a file
$ Filename = "http://www.jb51.net/logo.gif ";
$ Handle = fopen ($ filename, "r ");
$ Contents = fread ($ handle, filesize ($ filename ));
Fclose ($ handle );
// Create a data table
$ Db-> exec ('create TABLE person (idnum TEXT, name TEXT, photo BLOB )');
$ Stmt = $ db-> prepare ("insert into person VALUES ('201742119720101001x ', 'zhangsan ',?) ");
$ Stmt-> bindValue (1, $ contents, SQLITE3_BLOB );
$ Stmt-> execute ();
Read Data Files: php2.php
The code is as follows:
$ Pdo = new SQLite3 ('mysqlitedb. db ');
$ Results = $ pdo-> query ('select * from person ');
While ($ row = $ results-> fetchArray ()){
Ob_start ();
Header ("Content-Type: image/jpg ");
Echo $ row ['photo'];
Ob_end_flush ();
}
?>
Web page reference:
The code is as follows:
ANSYS tutorial
...