简体   繁体   English

"如何在 php 代码中插入 href 链接?"

[英]How do I insert href link in php code?

I am trying to insert a clickable link into a PHP code with no success.我试图在 PHP 代码中插入一个可点击的链接,但没有成功。 I only know html so I tried to insert html href code but it's not working.我只知道 html,所以我尝试插入 html href 代码,但它不起作用。

Original Code:原始代码:

echo '<br/>'.__("Your auction isn't live yet, the admin needs to approve it.</br>For more info CLICK HERE.", "AuctionTheme");
<?php
echo '<br/>'."Your auction isn't live yet, the admin needs to approve it.</br>For more info <a href=\"www.website.com\" target=\"_blank\" >CLICK HERE</a>";
?>

You have some basic errors in your code.您的代码中有一些基本错误。 Number one, you need to use proper wrapping quotes.第一,您需要使用正确的包装引号。 If you have double quotes after echo<\/code> , you will need to escape double quotes for your href inside the anchor tag:如果echo<\/code>后有双引号,则需要在锚标记内为 href 转义双引号:

echo "<a href=\\"www.website.com\\">Link Here<\/a><\/code>

However, to avoid having to escape out your double quotes, you can wrap the echo with single quotes '<\/code> , and use standard double quotes:但是,为了避免必须转义双引号,您可以用单引号'<\/code>包裹回显,并使用标准双引号:

echo '<a href="www.website.com">Link Here</a>';

Why is the first link not showing up in my tests even though it is the same as the third link?为什么我的测试中没有显示第一个链接,即使它与第三个链接相同? I'm sorry, but I don't know how to write the code.对不起,我不知道如何编写代码。 here is a link google.drive-test.txt<\/a>这是一个链接google.drive-test.txt<\/a>

"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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