使用php echo在img文件下显示文本[关闭]

Someone can you tell me how to change my code to show variables in link:

echo '<a href="download.php?q='.$title.'"><img src="'.$img.'" /></a>';

this shows img file but i want under this img to show title with text. Try this, but don't work:

echo '<a href="download.php?q='.$title.'">'.$title'</a>';

You forgot your ending dot.

replace

echo '<a href="download.php?q='.$title.'">'.$title'</a>';

with

echo '<a href="download.php?q='.$title.'">'.$title.'</a>';

Are you looking for this:

<?php

echo '<a href="download.php?q="'.$title.'"><img src="'.$img.'" /></a>';

?>

I think you're looking for this:

 echo '<a href="download.php?q='.$title.'"><img src="'.$img.'" />'.$title.'</a>';

You can use heredoc syntax.

echo <<<EOT
 <a href="download.php?q={$title}"><img src="{$img}" /></a>
EOT;