dongyonglie5132 2014-04-10 19:50
浏览 46
已采纳

如何使用单引号回显字符串而不使用反斜杠

Here is my code

$user_data = "I'm awesome";
echo $user_data;

This for some reason echoes I\'m awesome in my site. I found this odd and weird. I put it in a variable because the value of this changes within the action of a function, searching through a MySQL Database. I cannot find the problem. Please HELP!

  • 写回答

1条回答 默认 最新

  • douzuanze0486 2014-04-10 19:56
    关注

    I would use stripslashes() function

    $user_data = "I'm awesome";
    $user_data = stripslashes($user_data);
    echo $user_data;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?