回声中的PHP链接

时间:2011-03-12 19:58:54

标签: php text hyperlink echo

我有下面的回音,我需要链接到它,但我在该行的链接上得到一个意想不到的T_STRING,它表示期待','或';'

代码是:

echo " You Are Now A User Of ClipBoy! 
       Drag the image below to your bookmarks bar for easy access to your site! 
       To get to your site go to 
       <a href"http://themacsplash.com/ClipBoy/userfiles/$myUser" target "_blank">
       http://themacsplash.com/ClipBoy/userfiles/$myUser</a>";

我该如何解决这个问题?

4 个答案:

答案 0 :(得分:4)

转义字符串中的双引号,例如\"

所以它变成了:

echo " You Are Now A User Of ClipBoy! 
       Drag the image below to your bookmarks bar for easy access to your site! 
       To get to your site go to 
       <a href=\"http://themacsplash.com/ClipBoy/userfiles/$myUser\" target=\"_blank\">
       http://themacsplash.com/ClipBoy/userfiles/$myUser</a>";

答案 1 :(得分:1)

您需要使用"

转义\"

答案 2 :(得分:0)

你必须逃避双引号

答案 3 :(得分:0)

试试这个:

 echo ' You Are Now A User Of ClipBoy! Drag the image below to your bookmarks bar for easy access to your site! To get to your site go to <a href="http://themacsplash.com/ClipBoy/userfiles/'.$myUser.'" target="_blank">http://themacsplash.com/ClipBoy/userfiles/'.$myUser.'</a>'; 

或:

 echo " You Are Now A User Of ClipBoy! Drag the image below to your bookmarks bar for easy access to your site! To get to your site go to <a href=\"http://themacsplash.com/ClipBoy/userfiles/$myUser\" target=\"_blank\">http://themacsplash.com/ClipBoy/userfiles/$myUser</a>";