Home  >  Article  >  Backend Development  >  php转义符号怎么转换

php转义符号怎么转换

WBOY
WBOYOriginal
2016-06-13 13:21:001188browse

php转义符号如何转换?
php中返回的字符串是这样格式的[\"1\",\"2\",\"3\",\"4\"]我想替换成["1","2","3","4"]格式的

------解决方案--------------------

PHP code
$str='[\"1\",\"2\",\"3\",\"4\"]';
echo preg_replace('/\\\/','',$str);
<br><font color="#e78608">------解决方案--------------------</font><br>可能是你在PHP的配置中开启了自动转义输入数据( magic_quotes_gpc),可以用 stripslashes()来消除转义符\<br>
PHP code
$input = '[\"1\",\"2\",\"3\",\"4\"]';
echo stripslashes($input); <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn