我想在推特卡中查看每个用户的用户名,当他们共享他们的用户名或在我的网站上收到的消息时。但我得到的错误是twitter meta标记未读取变量内容,而是将其视为字符串。
以下是在Twitter卡验证程序上的外观:
这是我的网站上的元标记:
<meta property="twitter:card" content="summary">
<meta name="twitter:app:name:googleplay" content="">
<meta name="twitter:app:id:googleplay" content="">
<meta property="twitter:site" content="">
<meta name="twitter:title" content="<?php echo '$username'; ?>">
<meta name="twitter:text:title" content="<?php echo '$username'; ?>">
如果您能指导我做错什么以及如何做我想做的事情。
您的PHP代码必须不带引号:
<?php echo $username; ?>
或
<?php echo "{$username}"; ?>