简体   繁体   中英

PHP : echo a href

I have this php line which works fine:

echo "<p><a href=\"https://www.facebook.com/". $post['id'] . "\"target=\"_blank\">" . $post['message']. "</a></p>";

But I want to change it so it will link to my page (not to a single post). So it should look like that.

echo "<p><a href=\"https://www.facebook.com/rscmovement" "\"target=\"_blank\">" . $post['message']. "</a></p>";

I have tried a lot many proposition gathered on different website, but each time I am getting an error.

Any idea ?

Thanks a lot!

Using single and double quotes, you avoid escaping issues. Try this:

echo '<p><a href="https://www.facebook.com/rscmovement" target="_blank">'. $post['message']. '</a></p>';

我看到您没有逃脱关闭href属性的双引号:

echo "<p><a href=\"https://www.facebook.com/rscmovement\" target=\"_blank\">" 

I guess You have missed the back slash () before " after www.facebook.com/rscmovement. "

https://www.facebook.com/rscmovement\\" "\\"target=\\"_blank\\">" will

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM