
正文
php文件与数据库存储 php文件与数据库存储的关系
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
php文件中如何连接数据库
可以下载phpmyadmin软件,用这个软件,会直接显示你的数据库,不用使用insert等sql语句,在软件里有相应的点击符号,通过对这些符号的使用点击,就可以对任何表进行增删改查操作。存储数据的数据库,如果是mysql的,在mysql中的data目录下。其他数据库的各异。
相关问答
Q1: php连接数据库文件存放在什么目录下
进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择你需要的模块,比如curl模块:cd curl执行phpize生成编译文件!
phpize在PHP安装目录的bin目录/usr/local/php5/bin/phpize运行时,
可能会报错:Cannot find autoconf. Please check your autoconf installation andthe $PHP_AUTOCONFenvironment variable is set correctly and then rerun thisscript.,需要安装autoconf:yum install autoconf(RedHat或者CentOS)、apt-get installautoconf(Ubuntu Linux)!
执行/usr/local/php5/bin/php -v这个命令时,php会去检查配置文件是否正确,
如果有配置错误,这里会报错,可以根据错误信息去排查!
Q2: 如何用php将.txt的文件路径存储在数据库中,并在页面中通过点击显示的文件名读取
必须用上传控件,数据库里的是虚拟路径,文件必须物理上存在的。
string
size
=
fileupload1.postedfile.contentlength.tostring();
double
imagesize
=
math.round(float.parse(size)
/
1024,
1);
if
(imagesize
150)
{
m.show("你上传的图片大小为:"
+
imagesize.tostring()
+
"kb\\n\\n已超范围规定的150kb了");
return;
}
string
name
=
fileupload1.filename;
string
type
=
name.substring(name.lastindexof(".")
+
1).tolower();
system.guid
guid
=
system.guid.newguid();
string
vsnewname
=
guid.tostring();//声称文件名,防止重复
fileupload1.saveas(httpcontext.current.server.mappath("~/file/"
+
vsnewname
+
"."
+
type));
string
path
=
"~/file/"
+
vsnewname
+
"."
+
type;
php文件与数据库存储的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于php文件与数据库存储的关系、php文件与数据库存储的信息别忘了在本站进行查找喔。







