function formatUpdate($tweet,$dt,$picture,$username)
{
if(is_string($dt)) $dt=strtotime($dt);
$tweet=htmlspecialchars(stripslashes($tweet));
$at = "@" . $username;
return'
<li>
<a href="nano.com/' . $username . '"><img class="avatar" src="images/' . $picture . '" width="48" height="48" alt="avatar" /></a>
<div class="tweetTxt">
<strong><a href="nano.com/' . $username . '">' . $username . '</a></strong> '. preg_replace('/((?:http|https|ftp):\/\/(?:[A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?[^\s\"\']+)/i','<a href="$1" rel="nofollow" target="blank">$1</a>',$tweet).'
<div class="date">'.relativeTime($dt).'</div> <a class ="reply" href="?replyto=' echo $at; '">reply</a>
</div>
<div class="clear"></div>
</li>';
}
-1
A
回答
0
要将变量的值追加到你不用回显变量的字符串。
你有
href="?replyto=' echo $at; '">reply</a>
将其更改为
href="?replyto='. $at .'">reply</a>
+0
您的权利感谢,但问题它在页面上显示@username而不是“回复”链接?它的奇妙。我想我会做连接错误 – getaway 2010-09-14 04:13:08
1
螺栓是正确的。通常concat问题与代码,文字和结束引号/双引号混淆混淆。尝试使用heredoc来清理你的代码块。
例如,我会做以下操作来拯救我的眼睛代码盯着从疯狂救我的脑海里试图找到其中的语法错误的是(只有伪编码):
$at = "@$username";
$rt = relativeTime($dt);
$out = <<<raw
<div class="date">$rt</div>
<a class ="reply" href="?replyto=$at">reply</a>
raw;
刚看看它看起来更简单呃?
了解heredoc这里是一个阅读参考。
裁判:http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
相关问题
- 1. PHP字符串连接问题
- 2. 字符串连接问题
- 3. 字符串连接问题()
- 4. 字符串连接++问题
- 5. 连接字符串问题
- 6. 连接字符串问题
- 7. 连接字符串问题
- 8. NHibernate的连接字符串问题
- 9. ColdFusion JDBC连接字符串问题
- 10. SQL Server连接字符串问题
- 11. C中的字符串连接问题
- 12. WPF中的连接字符串问题
- 13. sql连接字符串问题
- 14. python字符串连接的问题
- 15. IBM iSeries连接字符串问题
- 16. C#连接字符串加密问题
- 17. 连接字符串问题Oracle .Net
- 18. c#,oledb连接字符串问题
- 19. 在连接字符串问题
- 20. C++连接字符串问题
- 21. iPhone:问题与字符串连接
- 22. 问题使用的连接字符串
- 23. 问题与Ruby的字符串连接
- 24. 连接字符串和ISAM问题
- 25. asp.net中连接字符串的问题
- 26. DB2连接字符串问题
- 27. 连接字符串有什么问题
- 28. 与字符串连接VBA问题
- 29. EntityFrame工作连接字符串问题
- 30. Swift字符串连接问题
在你的问题中的代码的格式非常简洁,最后一行是一个语法错误本身。我甚至不确定mattbasta的编辑是否做了任何改进。你能粘贴完整的代码吗? – BoltClock 2010-09-14 03:52:22
这只是代码的一部分,我只是想向您展示代码片段以证明我的问题! – getaway 2010-09-14 03:53:30
好吧,您的代码现在看起来的样子,您既不将该字符串分配给变量也不回应它。如果你的代码看起来像这样,就有问题。 – BoltClock 2010-09-14 03:55:21