PHP Ссылка в эхо - PullRequest
       49

PHP Ссылка в эхо

0 голосов
/ 12 марта 2011

У меня есть эхо ниже, и мне нужно связать его, но я получаю неожиданный 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 ]

4 голосов
/ 12 марта 2011

Избегайте двойных кавычек в вашей строке, как это \"

Так становится:

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 голос
/ 12 марта 2011

Вам нужно сбежать " с помощью \"

0 голосов
/ 12 марта 2011

попробуйте это:

 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>"; 
0 голосов
/ 12 марта 2011

Вы должны избежать двойных кавычек

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...