小编Cod*_*ody的帖子

我可以在一个字符串中使用str_replace两次吗?

<?php
echo "I'm currently listening to</a> <a href='http://last.fm/artist/" . str_replace(" ","+",$artist) . "/_/"  . str_replace(" ","+",$currenttrack) . "'>" . $currenttrack . "</a>";
?>
Run Code Online (Sandbox Code Playgroud)

以上是我的代码.我想str_replace()再次使用$artist并$currenttrack喜欢:

str_replace("'","%27",$artist) 和 str_replace("'","%27",$currenttrack)

因为撇号没有正确地通过我的代码混乱,但是当我首先使用空格时,它已经通过并且不会再次改变.

我能做什么?

php str-replace

1
推荐指数
1
解决办法
1454
查看次数

标签 统计

php ×1

str-replace ×1