【问题标题】:How to Remove \r and \n from json string in cakephp 3?如何从 cakephp 3 中的 json 字符串中删除 \r 和 \n?
【发布时间】:2018-03-09 18:21:45
【问题描述】:

在做 json_encode 之后我有下面这样的字符串

[{"pid":1,"name":"Patient1","mobile":"123456789","birthdate":"07/23/1991","address":"57, New Building,\r\nCollege Road,\r\nPune-3545001","created":"2017-09-25T08:14:10+00:00","modified":"2017-09-25T12:27:20+00:00"}]

那么我怎样才能删除 \r 和 \n。

【问题讨论】:

    标签: json cakephp cakephp-3.0


    【解决方案1】:
    str_replace('\r\n', '', $string);
    

    【讨论】:

    • 是的,抱歉迟到了
    猜你喜欢
    • 2016-06-20
    • 2019-02-04
    • 2021-12-06
    • 1970-01-01
    • 2022-01-24
    • 2016-01-05
    • 2019-10-24
    • 2014-03-18
    • 2020-09-25
    相关资源
    最近更新 更多