发布网友 发布时间:2022-04-23 21:26
共2个回答
热心网友 时间:2022-04-07 11:27
你用下面的代码试试:
$json= '{"createForm":{"multiple":1,"shareType":"SELF","title":"","description":"","minSubscriptionCost":"0.00","subscriptionCost":"0.00","commissionRate":"0.00","baodiCost":"0.00","secretType":"FULL_PUBLIC","mode":"COMPOUND","content":"1:02,11\r\n1:01,10\r\n1:01,03\r\n1:08,02\r\n1:01,03\r\n1:05,06\r\n1:08,09\r\n1:02,01\r\n1:07,06\r\n1:07,04","periodId":48308,"units":10,"schemeCost":20,"playType":"RandomTwo"},"lotteryType_key":"sdel11to5","ajax":"true"}';
$data = json_decode($json, true);
$content = $data['createForm']['content'];
// 注意,这里的$content中包含"\r\n",如果你是保存到普通文件,则他本身就是换行符,所以直接将$content保存到文件即可,如果你是在页面中输出,则有两种方式
// 方式1
$contents = explode('\r\n');
foreach ($contents as $v) {
echo $v,'<br />';
}
// 方式2
$content = preg_replace('/\r\n/', '<br />', $content);
echo $content;
热心网友 时间:2022-04-07 12:45
下面的代码运行结果就是你需要的,请参考: