Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从自定义字段回显外部链接-电子邮件(mailto:)_Php_Wordpress - Fatal编程技术网

Php 从自定义字段回显外部链接-电子邮件(mailto:)

Php 从自定义字段回显外部链接-电子邮件(mailto:),php,wordpress,Php,Wordpress,我现在有点像 <?php $url = get_post_meta( get_the_ID(), 'email_address', true); if (!empty($url)) { ?> <img src="/wp-content/themes/ibusiness/img/mail.png"> <a href="<?php echo $url; ?>">Email Organisation</a> <p

我现在有点像

<?php
    $url = get_post_meta( get_the_ID(), 'email_address', true);
    if (!empty($url))
    {
?>
<img src="/wp-content/themes/ibusiness/img/mail.png">
<a href="<?php echo $url; ?>">Email Organisation</a>
<p>'<?php
    }
?>

"
虽然这确实如我所期望的那样显示,但输出是一个带有附加到当前URL末尾的电子邮件地址的链接-无论我在哪里尝试添加邮件收件人:只需中断代码。

替换

<a href="<?php echo $url; ?>">Email Organisation</a>



它可能会起作用。

那么
呢?如果它出现在当前url的末尾,那么您的一个函数就有问题,您只需要电子邮件地址returned@Vector:记住相对URL是如何工作的。如果
$url
”foo@example.com
,则浏览器将解释URL并将其显示为
http://www.current-site.com/current-page/foo@example.com“
。如果生成的url是正确的,这将起作用
<a href="mailto:<?php echo $url; ?>">Email Organisation</a>