php代码有关问题

WBOY
Release: 2016-06-13 12:04:11
Original
891 people have browsed it

php代码问题
$filename = 'strval($id). ".gif" ';
想在右边这个图片加个路径比如这样$filename =images/ 'strval($id).".gif"'; 
判断images文件夹下的'strval($id).".gif"'图片是否存在。
但是代码读取不进去,求解代码错误的地方
本人是个php 新手求指教谢谢!
------解决方案--------------------
不该有引号的你却有
该有引号的你却没有

$filename = "images/" . strval($id) . ".gif"'; 
------解决方案--------------------
单引号包含的字符串,会当作字符串原样输出
双引号包含的字符串,会解析里面的特殊字符,如$id
并且单引号的效率比双引号快一些
------解决方案--------------------
這樣寫就可以了

<br />$filename = 'images/'.strval($id).'.gif'; <br />
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template