file_put_contents 保存图片路径怎么设置?

WBOY
Libérer: 2016-06-23 13:09:26
original
3115 Les gens l'ont consulté

file_put_contents 保存图片路径怎么设置?
我代码 $img_size = file_put_contents("D://www/web/public/". $pic_name, $img_data);
他提示:Warning: file_put_contents(D://www/web/public/gs_237f015b.gif): failed to open stream: No such file or directory 
public这个文件夹存在的


回复讨论(解决方案)

$img_size = file_put_contents("D:/www/web/public/". $pic_name, $img_data);

$img_size = file_put_contents("D:/www/web/public/". $pic_name, $img_data);


这样写不行呀,提示Warning: file_put_contents(D://www/web/public/gs_237f015b.gif): failed to open stream: No such file or directory

D://www/web/public
仔细检查一下这个目录存在吗

D://www/web/public
仔细检查一下这个目录存在吗


确定存在,换了好几个目录了,都不行

你的系统是? 
现在的代码是?

你的系统是? 
现在的代码是?


系统是windows,代码就是你写的代码,如果换成$img_size = file_put_contents(" ". $pic_name, $img_data);这样就可以上传到根目录

D://www/web/public 是你项目根目录吗,当前执行的文件在哪个目录?贴出你的目录结构。

D://www/web/public 是你项目根目录吗,当前执行的文件在哪个目录?贴出你的目录结构。


不是,这个是根目录D://www/web,我想把图片传到D://www/web/public文件夹下

$img_size = file_put_contents("public/". $pic_name, $img_data);
这样呢

$img_size = file_put_contents("public/". $pic_name, $img_data);
这样呢


这样可以了。谢谢了
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!