我无法找到问题的答案。我想做的是如下:我试图确保在这个引用中引用“......”和“它们......”。看起来使用变量似乎很难。
$title = get_the_title();
echo '<meta name="description" content= "Blabla some '.title.' here as well, but is it "the '.$title.'" or "them '.$title.'"?" />';
但是当我检查我的页面源时,我看到的是它没有按预期使用引号。我想确保“[titlevariablehere]”和“他们[titlevariablehere]”,实际上作为引号输出并被视为内容的一部分。
我怎样才能做到这一点?我尝试使用反斜杠,但仍然存在同样的问题。
答案 0 :(得分:2)
这里的问题不是PHP,因为引号也与定义content
的周围引号相同。
所以更改周围的引号如下:
echo '<meta name="description" content=\'Blabla, but is it "the '.$title.'" or "them '.$title.'"?\' />';