本文介绍了如何在字符串中使用函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
'<a rel="nofollow" href="$1" class="bbc_link new_win" target="_blank">'
我想使用urlencode()函数:
'<a rel="nofollow" href="urlencode($1)" class="bbc_link new_win" target="_blank">'...但是我不能使用它:
... but I can't use this:
'<a rel="nofollow" href="'.urlencode($1).'" class="bbc_link new_win" target="_blank">'...,因为$1不是字符串中的变量;相反,它是一个简单的免费论坛中的元变量.
... because $1 is not a variable in the string; it is instead a meta-variable in a simple free forum.
它发送www.test/out.php?out=www.example
推荐答案这个疯狂的黑客怎么样?
how about this crazy hack?
<? $_ = 'urlencode'; echo "<a rel=\"nofollow\" href=\"{$_($1)}\" class=\"bbc_link new_win\" target=\"_blank\">";更多推荐
如何在字符串中使用函数?
发布评论