问题描述:

This question already has an answer here:

  • Concatenation Operator

    4 answers

网友答案:

Change:

echo '<div class="news-item-detail"><a href="$url" class="news-item-title" target="_blank">$name</a>';

to either:

echo "<div class='news-item-detail'><a href='$url' class='news-item-title' target='_blank'>$name</a>";

or

echo '<div class="news-item-detail"><a href=' . $url . ' class="news-item-title" target="_blank">' . $name . '</a>';

And read the difference about quote styles and strings at http://php.net/manual/en/language.types.string.php

相关阅读:
Top