Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 MySQL 查询中选择一个文本列以导出到 PHP 脚本中的 csv 文件。事实证明,文本列有回车,这导致另一端的导入出现问题。
如何在进行查询时删除回车并只显示文本?这是我当前的查询:
SELECT marketing_remarks AS MarketingRemarks WHERE column = "blah"
SELECT REPLACE(marketing_remarks, '\r', '') AS MarketingRemarks WHERE column = "blah"
像这样的东西?
您可以在查询中执行此操作(根据 Fredd 的回答),也可以在 PHP 中执行:
str_replace("\r", '', $result); // remove carriage returns
会有一些因素决定哪种方法最适合您