加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 如何在字符串中使用函数?

发布时间:2020-12-13 18:23:10 所属栏目:PHP教程 来源:网络整理
导读:'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"' ……但我不能用这个: 'a rel="nofollow" href="'.urlencode($1).'
'<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">'

……但我不能用这个:

'<a rel="nofollow" href="'.urlencode($1).'" class="bbc_link new_win" target="_blank">'

…因为$1不是字符串中的变量;它是一个简单的免费论坛中的元变量.

它发送http://www.test.com/out.php?out=http://www.example.com

这个疯狂的黑客怎么样?
<?
$_ = 'urlencode';
echo "<a rel="nofollow" href="{$_($1)}" class="bbc_link new_win" target="_blank">";

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读