Home > Article > Backend Development > php转义符号怎么转换
php转义符号如何转换?
php中返回的字符串是这样格式的[\"1\",\"2\",\"3\",\"4\"]我想替换成["1","2","3","4"]格式的
------解决方案--------------------
$str='[\"1\",\"2\",\"3\",\"4\"]'; echo preg_replace('/\\\/','',$str); <br><font color="#e78608">------解决方案--------------------</font><br>可能是你在PHP的配置中开启了自动转义输入数据( magic_quotes_gpc),可以用 stripslashes()来消除转义符\<br>
$input = '[\"1\",\"2\",\"3\",\"4\"]'; echo stripslashes($input); <div class="clear"> </div>