duanju7199
2015-09-30 07:49
浏览 64
已采纳

用双引号回复反斜杠的php字符串

I have this string:

while($this->stmt->fetch()){
                $string=$string.'","'.$idRuolo;
                $i++;
            }       
            $str= ltrim($string,',"');

      $str=stripslashes($str); 

            echo json_encode($str);

I have tried everything but I can't delete the backslash from the result, this is the output:

"2\",\"1\",\"3"

this is what I want:

"2","1","3"

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

  • dongwo1234 2015-09-30 07:51
    最佳回答

    Try str_replace.

    $str = str_replace("\\","",$str);
    
    评论
    解决 无用
    打赏 举报
查看更多回答(2条)

相关推荐 更多相似问题