[英]Php syntax error, little help
I have this string: 我有这个字符串:
$imagename ="$ad_id_stripped"."_1".".jpg";
$display_table.="<a href='../ad.php?ad_id=$row[ad_id]' target='_parent'>
<img style='border:none;' src='../ad_images/$category/thumbs/$imagename?time()' class='shadow'></a>";
echo $display_table;
As you maybe can see I am trying to add the time() function in there... However, there is no time() added to it like this! 如您可能看到的那样,我正在尝试在其中添加time()函数。但是,没有像这样向其中添加time()! I have tried with various quotes etc without luck... 我尝试过各种报价等,没有运气...
Any ideas? 有任何想法吗?
Thanks 谢谢
$imagename ="$ad_id_stripped"."_1".".jpg";
$display_table.="<a href='../ad.php?ad_id=$row[ad_id]' target='_parent'>
<img style='border:none;' src='../ad_images/$category/thumbs/$imagename?" . time() . "' class='shadow'></a>";
echo $display_table;
You want to get the time()
function out of the string itself and concatenate 您想从字符串本身中获取time()
函数并进行连接
You can't do: 您不能:
$string = "....time()...";
You will need to do: 您需要执行以下操作:
$string = "..." . time() . "....";
or 要么
$time = time();
$string = "....$time...";
Strings wrapped in double quotes will parse variables, but not functions. 用双引号引起来的字符串将解析变量,但不解析函数。 Try this: 尝试这个:
$imagename ="$ad_id_stripped"."_1".".jpg";
$time = time();
$display_table.="<a href='../ad.php?ad_id=$row[ad_id]' target='_parent'>
<img style='border:none;' src='../ad_images/$category/thumbs/$imagename?$time' class='shadow'></a>";
echo $display_table;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.