2014-05-15 69 views
0

我已经添加下面的网址代码:URL标记验证错误

<a href='http://facebook.com/share.php?u="<?php urlencode(the_permalink()); ?>"&amp;t="<?php urlencode(the_title()); ?>"' target="_blank"><i class="icon-facebook"></i><?php _e('Facebook', 'domain'); ?></a> 

它生成的输出:

<a href='http://facebook.com/share.php?u="http://example.com/abc/"&amp;t="Lorem ipsum dolor sit amet"' target="_blank"><i class="icon-facebook"></i>Facebook</a> 

但我在验证得到错误:

不良值 http://facebook.com/share.php?u=http://example.com/abc/”& t =“Lorem ips um dolor sit amet“for属性href元素a:非法 查询中的字符:不是URL代码点

我该如何解决这个错误? 谢谢。

回答

0

请勿在网址中使用"。你的链接元素格式应该是这样的;

<a href="http://www.domain.com?a=john" target="_blank">User</a> 

你可以参考here html链接格式,你可以使用这个;

<a href="http://facebook.com/share.php?u=<?php urlencode(the_permalink()); ?>&amp;t=<?php urlencode(the_title()); ?>" target="_blank"><i class="icon-facebook"></i><?php _e('Facebook', 'domain'); ?></a> 
+0

我已经试过,没有“”,它根本没有任何帮助。 – user1117313

+0

@ user1117313有什么错误?或者你能看到页面源代码中生成的链接? –

+0

谢谢,我已经知道了。标题中有空格,这是URL的一部分。所以我设法修复它。 – user1117313