我在wordpress页面中有这个php代码

$str = 's.aspx?sm=Q830I7SJZvuSP3HzDfFlVA%3d%3d';

printf('<a href="https://www.surveymonkey.com/.urlencode($str)." target="_blank">
            <img src="http://www.anyfood.gr/net/wp-content/uploads/2014/12/evaluation2.jpg" style="padding:20px;">
       </a>'
);

但是链接不起作用,我试过几个可能的技巧,使用单引号等。
但我想不出来……有什么想法吗?

最佳答案

试试这个,它对我有效:

<?php
$str = 's.aspx?sm=Q830I7SJZvuSP3HzDfFlVA%3d%3d';

printf('<a href="https://www.surveymonkey.com/%1$s " target="_blank"> <img src="http://www.anyfood.gr/net/wp-content/uploads/2014/12/evaluation2.jpg" style="padding:20px;"> </a>', urlencode($str));
?>

关于php - 带有特殊字符的PHP脚本网址,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27655592/

10-09 15:41
查看更多