主要数组是:
array (size=2)
0 =>
array (size=2)
'message' => string 'Dear subscriber,
We are working to resolve your link down issue.
It will take approximately 2-4 hours to fix the issue.We appreciate your cordial support and patience during this time.
Thanks for being with us.
Techno' (length=231)
'created_at' => string '01:04 pm 11/01/2022' (length=19)
1 =>
array (size=2)
'message' => string 'Dear subscriber,
We are working to resolve your link down issue.
It will take approximately 2-4 hours to fix the issue.We appreciate your cordial support and patience during this time.
Thanks for being with us.
Techno' (length=231)
'created_at' => string '01:04 pm 11/01/2022' (length=19)在json_encode之后,集合会变成这样(其中包含了我们不想要的额外\n \r ):
'[{"message":"Dear subscriber, \nWe are working to resolve your link down issue. \nIt will take approximately 2-4 hours to fix the issue.We appreciate your cordial support and patience during this time.\n\nThanks for being with us.\nTechno","created_at":"01:04 pm 11\/01\/2022"},{"message":"Dear subscriber, \nWe are working to resolve your link down issue. \nIt will take approximately 2-4 hours to fix the issue.We appreciate your cordial support and patience during this time.\n\nThanks for'... (length=1173) 发布于 2022-01-12 11:03:56
如果您所需要的只是删除您提到的这两个字符(基本上是新行),您可以在json_encode $result上尝试这样的操作:
$result = str_replace("\\n", '', $result);
$result = str_replace("\\r", '', $result);例如,您可以找到更多的here选项。
https://stackoverflow.com/questions/70679621
复制相似问题