我正在尝试使用多个变量作为PHP中生成的图像中的字符串,但我不断收到以下错误:
Parse error: syntax error, unexpected '' - '' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\Projects\scrobbl.in\image.php on line 36
我做错了什么?
这是我的代码:
<?php
$img_number = imagecreate(275,25);
$backcolor = imagecolorallocate($img_number,102,102,153);
$textcolor = imagecolorallocate($img_number,255,255,255);
imagefill($img_number,0,0,$backcolor);
Imagestring($img_number,10,5,5,$currenttrack' - '$artist,$textcolor);
header("Content-type: image/jpeg");
imagejpeg($img_number);
?>
答案 0 :(得分:1)
这应该适合你:
Imagestring($img_number,10,5,5,"$currenttrack" . " - " . "$artist",$textcolor);