• <small id='Ib9ds'></small><noframes id='Ib9ds'>

  • <tfoot id='Ib9ds'></tfoot>

    1. <legend id='Ib9ds'><style id='Ib9ds'><dir id='Ib9ds'><q id='Ib9ds'></q></dir></style></legend>
        <i id='Ib9ds'><tr id='Ib9ds'><dt id='Ib9ds'><q id='Ib9ds'><span id='Ib9ds'><b id='Ib9ds'><form id='Ib9ds'><ins id='Ib9ds'></ins><ul id='Ib9ds'></ul><sub id='Ib9ds'></sub></form><legend id='Ib9ds'></legend><bdo id='Ib9ds'><pre id='Ib9ds'><center id='Ib9ds'></center></pre></bdo></b><th id='Ib9ds'></th></span></q></dt></tr></i><div id='Ib9ds'><tfoot id='Ib9ds'></tfoot><dl id='Ib9ds'><fieldset id='Ib9ds'></fieldset></dl></div>
          <bdo id='Ib9ds'></bdo><ul id='Ib9ds'></ul>

        PHP json_decode 整数和浮点数到字符串

        PHP json_decode integers and floats to string(PHP json_decode 整数和浮点数到字符串)

      1. <i id='BbSz8'><tr id='BbSz8'><dt id='BbSz8'><q id='BbSz8'><span id='BbSz8'><b id='BbSz8'><form id='BbSz8'><ins id='BbSz8'></ins><ul id='BbSz8'></ul><sub id='BbSz8'></sub></form><legend id='BbSz8'></legend><bdo id='BbSz8'><pre id='BbSz8'><center id='BbSz8'></center></pre></bdo></b><th id='BbSz8'></th></span></q></dt></tr></i><div id='BbSz8'><tfoot id='BbSz8'></tfoot><dl id='BbSz8'><fieldset id='BbSz8'></fieldset></dl></div>
      2. <tfoot id='BbSz8'></tfoot>

            • <bdo id='BbSz8'></bdo><ul id='BbSz8'></ul>

              1. <legend id='BbSz8'><style id='BbSz8'><dir id='BbSz8'><q id='BbSz8'></q></dir></style></legend>

                <small id='BbSz8'></small><noframes id='BbSz8'>

                  <tbody id='BbSz8'></tbody>

                  本文介绍了PHP json_decode 整数和浮点数到字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想预先解析一个 json 并将 json 中的所有数字(整数或浮点数)转换为字符串.

                  I want to pre-parse a json an convert all numbers in the json (integers or float) to strings.

                  例如:

                  {
                   "integer": 10000,
                   "big_integer": 100000999499498485845848584584584,
                   "float1" : 1.121212,
                   "float2" : 8.226347662837406e+09
                  }
                  

                  到这里:

                  {
                   "integer": "10000",
                   "big_integer": "100000999499498485845848584584584",
                   "float1" : "1.121212",
                   "float2" : "8226347662.837406"
                  }
                  

                  更新我找到了以下,但是它不适用于浮动:

                  Update I have found the following but it does not work for floats:

                  $jsonString = '[{"name":"john","id":5932725006},{"name":"max","id":4953467146}]';
                  
                  echo preg_replace('/("w+"):(d+)/', '\1:"\2"', $jsonString);
                  //prints [{"name":"john","id":"5932725006"},{"name":"max","id":"4953467146"}]
                  

                  更新 2 修复了第二个浮点值.它有两点.

                  Update 2 Fixed second float value. It had two points.

                  推荐答案

                  使用这个:它应该可以工作

                  Use this: It should work

                  echo preg_replace('/: *([0-9]+.?[0-9e+-]*)/', ':"\1"', $jsonString);
                  

                  这篇关于PHP json_decode 整数和浮点数到字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  <legend id='9GJ0x'><style id='9GJ0x'><dir id='9GJ0x'><q id='9GJ0x'></q></dir></style></legend>

                  <small id='9GJ0x'></small><noframes id='9GJ0x'>

                        • <bdo id='9GJ0x'></bdo><ul id='9GJ0x'></ul>

                          <tfoot id='9GJ0x'></tfoot>

                            <tbody id='9GJ0x'></tbody>

                          • <i id='9GJ0x'><tr id='9GJ0x'><dt id='9GJ0x'><q id='9GJ0x'><span id='9GJ0x'><b id='9GJ0x'><form id='9GJ0x'><ins id='9GJ0x'></ins><ul id='9GJ0x'></ul><sub id='9GJ0x'></sub></form><legend id='9GJ0x'></legend><bdo id='9GJ0x'><pre id='9GJ0x'><center id='9GJ0x'></center></pre></bdo></b><th id='9GJ0x'></th></span></q></dt></tr></i><div id='9GJ0x'><tfoot id='9GJ0x'></tfoot><dl id='9GJ0x'><fieldset id='9GJ0x'></fieldset></dl></div>