如何使用php回显图片? [英] How to echo picture using php?

查看:66
本文介绍了如何使用php回显图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我处理这些家伙,我有这个代码:

Please help me with this guys, I have this code:

if(move_uploaded_file($_FILES['userfile']['tmp_name'],"C:/xampp/htdocs/new/admin/gallery/{$_FILES['userfile']['name']}")
{
    echo '<center><img src="admin/gallery/{$_FILES['userfile']['name']}" width="100" height="100"/>'.'</center>';     
    // echo "success!:)";
} 
else 
{
    echo "photo not uploaded";
}

这里的问题是当我回显它并使用它的 tmpname 时,我在本节中出错

the problem here is when i echo it and use its tmpname i am having an error in this section

<img src="admin/gallery/{$_FILES['userfile']['name']}" width="100" //....

用户文件以红色下划线标出.使用它的临时名称来回应它是错误的吗?请帮帮我...

the userfile is underlined in red. Is it wrong to use its tempname in echoing it? help me please...

推荐答案

像这样改变你的 echo 语句,

Change your echo statement like this,

echo '<center><img src="admin/gallery/'.{$_FILES['userfile']['name']}.'" width="100" height="100"/>'.'</center>';

还有你的 if 检查显示不正确.

Also your if checks showing incorrectly.

可能是这样的,

if(move_uploaded_file($_FILES['userfile']['tmp_name'],"C:/xampp/htdocs/new/admin/gallery/{$_FILES['userfile']['name']")
{
 .....
}

这篇关于如何使用php回显图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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