如何从 PHP 中的字符串中删除 ANSI 代码(“
") [英] How to remove ANSI-Code ("
") from string in PHP

查看:33
本文介绍了如何从 PHP 中的字符串中删除 ANSI 代码(“
")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了很多,但没有任何效果.我想用 PHP 导入一个 XML 文件.在某些字符串中,客户放置了一些 ANSI 代码载波返回(
").我试图删除它们:

I have tried a lot but nothing is working. I want to import a XML-file with PHP. In some strings the customer puts some ANSI-Code Carrier Returns ("
"). I have tried to remove them with:

str_replace('
', '', $xml->description);

我也用 "
", " ", "&\#13;" 在搜索中,但没有任何效果.您知道如何删除这些换行符吗?

I also tried it with "
", " ", "&\#13;" in the search but nothing works. Do you have any idea how to remove these linebreaks?

谢谢!

推荐答案

由于您的 XML 处理器已经在处理实体的去实体化,您将剩下纯 ASCII 或 或 .PHP 不处理单引号内的 或 .当 和 在双引号内时,它只会将它们转换为各自的字符(代码 10 和 13).

Since your XML processor is already handling de-entitying the entities, you'll be left over with plain ASCII or or . PHP does not handle or inside of single quotes. It only translates them to their respective characters (codes 10 and 13), when the and are inside of double quotes.

你只需要使用 "或者 ".

You just need to use " " or maybe " ".

这篇关于如何从 PHP 中的字符串中删除 ANSI 代码(“
")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆