[英]How to remove curly braces from a sting with comma and curly braces
how to remove curly braces from a given string i have apply to all the matches to change the string.如何从给定的字符串中删除花括号我已应用于所有匹配项以更改字符串。
my output look like this is我的输出看起来像这样
{"Category":"TATA Wiron TW02","Quantity":"33 Kgs","Total Price":"4125"},{"Category":"Tata Wiron Aayush","Quantity":"33 Kgs","Total Price":"3630"}
then i will change that this type然后我会改变这种类型
Category:TATA Wiron TW02,Quantity:33 Kgs,Total Price:4125},{Category:Tata Wiron Aayush,Quantity:33 Kgs,Total Price:3630
but here i have get the problem is Total Price:4125},{Category:Tata Wiron Aayush
in this two items we make but dynamically so many items will be added how to remove it但在这里,我遇到的问题是
Total Price:4125},{Category:Tata Wiron Aayush
( Total Price:4125},{Category:Tata Wiron Aayush
,这是我们制造的这两项,但动态地添加了这么多物品,如何将其删除
my Code is:我的代码是:
<?php
session_start();
$out = $_SESSION["output"];
echo $out;
$data = preg_replace("/\{[^}]+\}/", "", $out);
$msg = trim($out, '{},');
$msg2 = trim($msg, '"');
$msg3= str_replace('"','',$msg2);
echo $msg3;
?>
how to remove curly braces from a given string i have apply to all the matches to change the string.如何从给定的字符串中删除花括号我已应用于所有匹配项以更改字符串。
my output look like this is我的输出看起来像这样
{"Category":"TATA Wiron TW02","Quantity":"33 Kgs","Total Price":"4125"},{"Category":"Tata Wiron Aayush","Quantity":"33 Kgs","Total Price":"3630"}
then i will change that this type然后我会改变这种类型
Category:TATA Wiron TW02,Quantity:33 Kgs,Total Price:4125},{Category:Tata Wiron Aayush,Quantity:33 Kgs,Total Price:3630
but here i have get the problem is Total Price:4125},{Category:Tata Wiron Aayush
in this two items we make but dynamically so many items will be added how to remove it但在这里,我遇到的问题是
Total Price:4125},{Category:Tata Wiron Aayush
( Total Price:4125},{Category:Tata Wiron Aayush
,这是我们制造的这两项,但动态地添加了这么多物品,如何将其删除
my Code is:我的代码是:
<?php
session_start();
$out = $_SESSION["output"];
echo $out;
$data = preg_replace("/\{[^}]+\}/", "", $out);
$msg = trim($out, '{},');
$msg2 = trim($msg, '"');
$msg3= str_replace('"','',$msg2);
echo $msg3;
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.