Home  >  Article  >  php教程  >  Parse error: syntax error, unexpected T_LNUMBER

Parse error: syntax error, unexpected T_LNUMBER

WBOY
WBOYOriginal
2016-05-25 16:53:022022browse

Parse error: syntax error, unexpected T_LNUMBER

<?php 
//首先你的变量赋值有问题,在没有进行str_replace()的时候就会报错 
$a = &#39;"女老师竭力向孩子们证明,<span>学习好功课的重要性女老师竭<a href="1">2222222222</a>力向孩子们&#39;证明&#39;,学习好功课的重要性女老师竭力向孩子们证明,学习好功课的重要性女老师竭力向孩子们证明,学习好功课的重要性女老师竭力向孩子们证明,学习好功课的重要性女老师竭力向孩子们证明"&#39;; 
echo str_replace("","\"",$a)

失败,提示 $a=""; 错误 Parse error: syntax error, unexpected T_LNUMBER

正确方法

方法一:echo str_replace(array('"',"'","‘","’"),"",$a);

方法二:str_replace("'"\"","",$a)

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