开发者

Putting image tags into php

Hello im using page nation which is amazing but now im trying to print off there avaratar im using this code

echo "<IMG SRC=\"$list['avatar']\" WIDTH=\"268\" HEIGHT=\"176\"
BORDER=\"0\" ALT=\"开发者_开发知识库\" \/>";;

but im getting this error

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in test.php on line 64


Try

echo "<IMG SRC=\"".$list['avatar']."\" WIDTH=\"268\" HEIGHT=\"176\"
BORDER=\"0\" ALT=\"\" />";

instead, or you could use this one, too

echo "<IMG SRC=\"{$list['avatar']}\" WIDTH=\"268\" HEIGHT=\"176\"
BORDER=\"0\" ALT=\"\" />";

or better and readable ones:

echo '<IMG SRC="'.$list['avatar'].'" WIDTH="268" HEIGHT="176" BORDER="0" ALT="" />';

echo '<IMG SRC="', $list['avatar'], '" WIDTH="268" HEIGHT="176" BORDER="0" ALT="" />';


I prefer this

echo "<IMG SRC=\"$list[avatar]\" WIDTH=\"268\" HEIGHT=\"176\" BORDER=\"0\" ALT=\"\" />";

eliminate de braces surrounding the variable and the single quotes for the array key


this should work :

echo '<IMG SRC="'.$list['avatar'].'" WIDTH="268" HEIGHT="176"
BORDER="0" ALT="" />';


to avoid all thet mess

?><IMG SRC="<?=$list['avatar']?> " WIDTH="268" HEIGHT="176" BORDER="0" ALT="" /><?php

and don't post your usual "parse error" comment here.
but check your other PHP syntax issue somewhere else


Try changing it to:

echo "<IMG SRC=\"{$list['avatar']}\" WIDTH=\"268\" HEIGHT=\"176\" BORDER=\"0\" ALT=\"\" />";

...or, less confusingly:

echo '<IMG SRC="'.$list['avatar'].'" WIDTH="268" HEIGHT="176" BORDER="0" ALT="" />';


Try it like this:

echo '<IMG SRC="'.$list['avatar'].'" WIDTH="268" HEIGHT="176" BORDER="0" ALT="" />'; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜