Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何在 MySQL 数据库中存储图像和文件。
我想得到这样的图像和文件www.example/rsrc.php/example-image.jpg
www.example/rsrc.php/example-image.jpg
Facebook 上的示例:facebook-example.com/rsrc.php/v2/yw/r/svhh826BLKd.png
在数据库表中创建一个 BLOB 列,
可能是中等大小。
但最好将照片保存在目录中并将路径保存在数据库中。干杯
CREATE TABLE tblname(ID INT,IMAGE BLOB); INSERT INTO tblname(ID,IMAGE) VALUES(1,LOAD_FILE('C:/test.txt'));
将评论中的答案添加到答案框中的此问题。