阅读文件夹 [英] Reading Folders

查看:118
本文介绍了阅读文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hiya,


如果我有几个充满图片的文件夹,怎样才能让PHP打开

文件夹,读取图片名称并保存图像名称(包含扩展名)到一个

MySQL数据库?


我要做的是使用PHP / MySQL创建一个图像库,这样

每次我需要大量的图片,我所要做的就是让PHP阅读

文件夹的内容并将文件名添加到MySQL数据库而不是

比必须手动将名字输入数据库


任何帮助都会很棒。


干杯。


DaRemedy

Hiya,

If I had several folders full of images, how can I get PHP to open the
folder, read the image names and save the image names (inc extension) to a
MySQL database?

What I am trying to do is create an image gallery using PHP/MySQL, so that
everytime i take a load of pics, all I would have to do is get PHP to read
the contents of the folder and add the filenames to a MySQL database rather
than having to manually input the names into the database

Any help would be great.

Cheers.

DaRemedy

推荐答案

2004年11月8日星期一19:32:10 +0000(UTC), DaRemedy

< de ****** @ btinternet.com.nospam>写道:
On Mon, 8 Nov 2004 19:32:10 +0000 (UTC), "DaRemedy"
<de******@btinternet.com.nospam> wrote:
如果我有几个文件夹充满图像,我怎样才能让PHP打开
文件夹,读取图像名称并保存图像名称(包含扩展名)到MySQL数据库?

我想要做的是使用PHP / MySQL创建一个图像库,这样每次我需要大量的图片,我会要做的是让PHP读取文件夹的内容并将文件名添加到MySQL数据库而不是手动将名称输入数据库
If I had several folders full of images, how can I get PHP to open the
folder, read the image names and save the image names (inc extension) to a
MySQL database?

What I am trying to do is create an image gallery using PHP/MySQL, so that
everytime i take a load of pics, all I would have to do is get PHP to read
the contents of the folder and add the filenames to a MySQL database rather
than having to manually input the names into the database




opendir,readdir循环+ mysql_query,closedir。


-

Andy Hassall /< an ** @ andyh.co .UK> /< http://www.andyh.co.uk>

< http://www.andyhsoftware.co.uk/space>空间:磁盘使用情况分析工具



opendir, loop of readdir + mysql_query, closedir.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool


DaRemedy写道:
DaRemedy wrote:
如果我有几个充满图片的文件夹,我怎样才能获得PHP打开
文件夹,读取图像名称并将图像名称(包含扩展名)保存到MySQL数据库中?

我要做的是创建一个图库使用PHP / MySQL,这样每次我需要大量的图片,我所要做的就是让PHP读取文件夹的内容并将文件名添加到MySQL数据库中。 >而不是必须手动将名称输入数据库
If I had several folders full of images, how can I get PHP to open the
folder, read the image names and save the image names (inc extension) to a
MySQL database?

What I am trying to do is create an image gallery using PHP/MySQL, so that
everytime i take a load of pics, all I would have to do is get PHP to read
the contents of the folder and add the filenames to a MySQL database
rather than having to manually input the names into the database


http://www.php.net/opendir & http://www.php.net/readdir

-

Chris Hope - 电动工具箱 - http ://www.electrictoolbox.com/



http://www.php.net/opendir & http://www.php.net/readdir

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/


DaRemedy写道:
DaRemedy wrote:
Hiya,

如果我有几个充满图像的文件夹,如何让PHP打开
文件夹,读取图像名称并将图像名称(包含扩展名)保存到一个
MySQL数据库?
的内容文件夹并将文件名添加到MySQL数据库而不是手动将名称输入数据库
Hiya,

If I had several folders full of images, how can I get PHP to open the
folder, read the image names and save the image names (inc extension) to a
MySQL database?

What I am trying to do is create an image gallery using PHP/MySQL, so that
everytime i take a load of pics, all I would have to do is get PHP to read
the contents of the folder and add the filenames to a MySQL database rather
than having to manually input the names into the database




如果文件名为col,你应该记住一件事你的MySQL是

将是独一无二的:


Linux文件系统区分大小写,因此FILENAME.gif FileName.gif,

和filename.gif都可以同时存在于同一目录中。 MySQL

文本字段不会以同样的方式区分大小写,因此你不能将所有三个存储在单独行中的同一个唯一字段中。

-

马特布拉德利

把聪明人的管放在猫腿上让它们像机器人一样走路。



One thing you should remember if the filenames col of your MySQL is
going to be unique:

The Linux filesystem is case-sensitive, so FILENAME.gif FileName.gif,
and and filename.gif can all exist in the same directory at once. MySQL
text fields however aren''t case sensitive in the same way, so you
couldn''t have all three stored in the same unique field in separate rows.
--
Matt Bradley
Put smarties tubes on cats legs make them walk like robots.


这篇关于阅读文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆