dqls67891 2012-03-31 23:03
浏览 56
已采纳

字符串中的字母之间的空字符

i have a problem using some php functions on a string i get from a file. When i read it in notepad++ it seems to have no spaces but when i echo in cmd there appear to be spaces between the letters, and if i capture that output in a file and read it with notepad++ those characters are red as a black NULL. How is that character expressed so i remove it. I am including a file since i cant write what happens here. thank you in advance

PS the string was written in a file with vbscript btw

  • 写回答

1条回答 默认 最新

  • doujia1988 2012-04-01 00:14
    关注

    Use str_replace:

    $str = file_get_contents("out.txt"); 
    $str = str_replace("\0", "", $str); 
    file_put_contents("out1.txt", $str);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?