Php 如何更改mysql数据库中图像的目录文件夹
我有php的表单,可以将照片从计算机文件夹上传到mysql数据库。照片我有一个文件夹img,但文件添加到数据库没有任何文件夹。如何更改目录 我的代码是:Php 如何更改mysql数据库中图像的目录文件夹,php,mysql,database,Php,Mysql,Database,我有php的表单,可以将照片从计算机文件夹上传到mysql数据库。照片我有一个文件夹img,但文件添加到数据库没有任何文件夹。如何更改目录 我的代码是: echo "<center><img src=" . $row["Photos"] . "></center>"; echo "<center><img src=\"/img/" . $row["Photos"] . "></center>"; 我试过这样的方法: ec
echo "<center><img src=" . $row["Photos"] . "></center>";
echo "<center><img src=\"/img/" . $row["Photos"] . "></center>";
我试过这样的方法:
echo "<center><img src="/img/ . $row["Photos"] . "></center>";
但它不起作用
我不知道在哪里可以找到解决办法 试试回声|
因为您的文件夹img必须位于html标记中请将代码更改为
echo '<center><img src="/img/' . $row["Photos"] . '"></center>';
您已将引号设置为错误的字符。
在这种情况下,必须使用单引号和普通引号。或者您必须对双引号进行如下编码:
echo "<center><img src="/img/ . $row["Photos"] . "></center>";