我有一个json文件,里面包含单引号。json_decode函数无法转换。用str_replace("'","",$json);替换后,还是无法转换。
请高手帮帮忙

解决方案 »

  1.   

    原始数组有么或者$json串复制上来看看
      

  2.   

    $json={ "pageinfo": { "pagenumber": 2, "pagesize": 50, "pagecount": 35 }, "loglist": [ { "type": "info", "time": "11:12:07", "note": "加载 \"事件管理模块\" 块成功。" },{ "type": "info", "time": "11:12:07", "note": "加载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "11:12:07", "note": "加载 \"HttpServer服务模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"销售订单模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"客户供应商模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"基础资料模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"人力资源模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"事件管理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"HttpServer服务模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"人力资源模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"基础资料模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"客户供应商模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"销售订单模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"事件管理模块\" 块成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"HttpServer服务模块\" 成功。" },{ "type": "error", "time": "11:19:15", "note": "执行客户端 192.168.0.235 的请求 \"\/hrms\/empctrl\/getemployeelist.do\" 发生出错。 错误信息: 过程或函数 'proc_EmpBaseInfoPaging' 需要参数 '@RecordCount',但未提供该参数。" },{ "type": "error", "time": "11:24:03", "note": "执行客户端 192.168.0.235 的请求 \"\/hrms\/empctrl\/getemployeelist.do\" 发生出错。 错误信息: Leve desc ,OrgCode desc ,SortId desc ,EmpId desc" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"销售订单模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"客户供应商模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"基础资料模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"人力资源模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"事件管理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"HttpServer服务模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"人力资源模块\" 成功。" }], "state": { "return": "true", "info": "", "code": "" } }
      

  3.   

    还有一点很是奇怪的,我用str_replace("'","",$json)替换后,输出到网页,然后从网页复制回来的是可以转换的,是不是str_replace得编码有问题啊。
      

  4.   

    $json="{ "pageinfo": { "pagenumber": 2, "pagesize": 50, "pagecount": 35 }, "loglist": [ { "type": "info", "time": "11:12:07", "note": "加载 \"事件管理模块\" 块成功。" },{ "type": "info", "time": "11:12:07", "note": "加载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "11:12:07", "note": "加载 \"HttpServer服务模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"销售订单模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"客户供应商模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"基础资料模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"人力资源模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"事件管理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"HttpServer服务模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"人力资源模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"基础资料模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"客户供应商模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"销售订单模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"事件管理模块\" 块成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"HttpServer服务模块\" 成功。" },{ "type": "error", "time": "11:19:15", "note": "执行客户端 192.168.0.235 的请求 \"\/hrms\/empctrl\/getemployeelist.do\" 发生出错。 错误信息: 过程或函数 'proc_EmpBaseInfoPaging' 需要参数 '@RecordCount',但未提供该参数。" },{ "type": "error", "time": "11:24:03", "note": "执行客户端 192.168.0.235 的请求 \"\/hrms\/empctrl\/getemployeelist.do\" 发生出错。 错误信息: Leve desc ,OrgCode desc ,SortId desc ,EmpId desc" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"销售订单模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"客户供应商模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"基础资料模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"人力资源模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"事件管理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"HttpServer服务模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"人力资源模块\" 成功。" }], "state": { "return": "true", "info": "", "code": "" } }" 
      

  5.   

    没有任何问题print_r(json_decode($json));
    得到stdClass Object
    (
        [pageinfo] => stdClass Object
            (
                [pagenumber] => 2
                [pagesize] => 50
                [pagecount] => 35
            )
     
        [loglist] => Array
            (
                [0] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:07
                        [note] => 加载 "事件管理模块" 块成功。
                    )
     
                [1] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:07
                        [note] => 加载 "Http代理模块" 成功。
                    )
     
                [2] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:07
                        [note] => 加载 "HttpServer服务模块" 成功。
                    )
     
                [3] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "Http代理模块" 成功。
                    )
     
                [4] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "销售订单模块" 成功。
                    )
     
                [5] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "客户供应商模块" 成功。
                    )
     
                [6] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "基础资料模块" 成功。
                    )
     
                [7] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "人力资源模块" 成功。
                    )
     
                [8] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "系统事件模块" 成功。
                    )
     
                [9] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "公共事件模块" 成功。
                    )
     
                [10] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "事件管理模块" 成功。
                    )
     
                [11] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "后台管理模块" 成功。
                    )
     
                [12] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "HttpServer服务模块" 成功。
                    )
     
                [13] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "会话管理模块" 成功。
                    )
     
                [14] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "数据库连接池模块" 成功。
                    )
     
                [15] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:09
                        [note] => 卸载 "配置文件模块" 成功。
                    )
     
                [16] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
                        [note] => 加载 "配置文件模块" 成功。
                    )
     
                [17] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
                        [note] => 加载 "数据库连接池模块" 成功。
                    )
     
                [18] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
                        [note] => 加载 "会话管理模块" 成功。
                    )
     
                [19] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
                        [note] => 加载 "后台管理模块" 成功。
                    )
     
                [20] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
                        [note] => 加载 "公共事件模块" 成功。
                    )
     
                [21] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
                        [note] => 加载 "系统事件模块" 成功。
                    )
     
                [22] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
                        [note] => 加载 "人力资源模块" 成功。
                    )
     
                [23] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
                        [note] => 加载 "基础资料模块" 成功。
                    )
     
                [24] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
                        [note] => 加载 "客户供应商模块" 成功。
                    )
     
                [25] => stdClass Object
                    (
                        [type] => info
                        [time] => 11:12:12
    .....
      

  6.   

    编码要utf-8格式json格式,最好由json_encode转换,
    $json='{ "pageinfo": { "pagenumber": 2, "pagesize": 50, "pagecount": 35 }, "loglist": [ { "type": "info", "time": "11:12:07", "note": "加载 \"事件管理模块\" 块成功。" },{ "type": "info", "time": "11:12:07", "note": "加载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "11:12:07", "note": "加载 \"HttpServer服务模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"销售订单模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"客户供应商模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"基础资料模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"人力资源模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"事件管理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"HttpServer服务模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "11:12:09", "note": "卸载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"人力资源模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"基础资料模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"客户供应商模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"销售订单模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"事件管理模块\" 块成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "11:12:12", "note": "加载 \"HttpServer服务模块\" 成功。" },{ "type": "error", "time": "11:19:15", "note": "执行客户端 192.168.0.235 的请求 \"\/hrms\/empctrl\/getemployeelist.do\" 发生出错。 错误信息: 过程或函数 \'proc_EmpBaseInfoPaging\' 需要参数 \'@RecordCount\',但未提供该参数。" },{ "type": "error", "time": "11:24:03", "note": "执行客户端 192.168.0.235 的请求 \"\/hrms\/empctrl\/getemployeelist.do\" 发生出错。 错误信息: Leve desc ,OrgCode desc ,SortId desc ,EmpId desc" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"Http代理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"销售订单模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"客户供应商模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"基础资料模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"人力资源模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"事件管理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"HttpServer服务模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "12:05:22", "note": "卸载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"配置文件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"数据库连接池模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"会话管理模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"后台管理模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"公共事件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"系统事件模块\" 成功。" },{ "type": "info", "time": "12:05:38", "note": "加载 \"人力资源模块\" 成功。" }], "state": { "return": "true", "info": "", "code": "" } }';
    $arr = json_decode($json);
    print_r($arr);
      

  7.   

    有用到str_replace("'","",$json)这个,第二个json中有单引号的呢
      

  8.   

    文件已经都是utf-8的格式了,这个json是服务器返回的
      

  9.   

    你只有一处有单引号,也没有问题呀$s = <<< JSON
    { "type": "error", "time": "11:19:15", "note": "执行客户端 192.168.0.235 的请求 \"\/hrms\/empctrl\/getemployeelist.do\" 发生出错。 错误信息: 过程或函数 'proc_EmpBaseInfoPaging' 需要参数 '@RecordCount',但未提供该参数。" }
    JSON;print_r(json_decode($s));
    stdClass Object
    (
        [type] => error
        [time] => 11:19:15
        [note] => 执行客户端 192.168.0.235 的请求 "/hrms/empctrl/getemployeelist.do" 发生出错。 错误信息: 过程或函数 'proc_EmpBaseInfoPaging' 需要参数 '@RecordCount',但未提供该参数。
    )
      

  10.   


    $s = <<< JSON 这里是什么意思啊,没看懂的呢,能不能解释一下啊
      

  11.   

    只是一种字符串表达式的写法而已,它使用自定义的字符串分界符表示字符串
    这样php默认的字符串分界符就可以当作普通字符了使用了
      

  12.   

    为方便解决你的问题,请帖出
    echo base64_encode(file_get_contents('json文件名'));
    的结果
      

  13.   

    base64_encode:
    ew0KICJwYWdlaW5mbyI6IHsNCiAgInBhZ2VudW1iZXIiOiAyLA0KICAicGFnZXNpemUiOiA1MCwNCiAgInBhZ2Vjb3VudCI6IDM1DQogfSwNCiAibG9nbGlzdCI6IFsNCiAgew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMToxMjowNyIsDQogICAibm90ZSI6ICLliqDovb0gXCLkuovku7bnrqHnkIbmqKHlnZdcIiDlnZfmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMToxMjowNyIsDQogICAibm90ZSI6ICLliqDovb0gXCJIdHRw5Luj55CG5qih5Z2XXCIg5oiQ5Yqf44CCIg0KICB9LHsNCiAgICJ0eXBlIjogImluZm8iLA0KICAgInRpbWUiOiAiMTE6MTI6MDciLA0KICAgIm5vdGUiOiAi5Yqg6L29IFwiSHR0cFNlcnZlcuacjeWKoeaooeWdl1wiIOaIkOWKn+OAgiINCiAgfSx7DQogICAidHlwZSI6ICJpbmZvIiwNCiAgICJ0aW1lIjogIjExOjEyOjA5IiwNCiAgICJub3RlIjogIuWNuOi9vSBcIkh0dHDku6PnkIbmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMToxMjowOSIsDQogICAibm90ZSI6ICLljbjovb0gXCLplIDllK7orqLljZXmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMToxMjowOSIsDQogICAibm90ZSI6ICLljbjovb0gXCLlrqLmiLfkvpvlupTllYbmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMToxMjowOSIsDQogICAibm90ZSI6ICLljbjovb0gXCLln7rnoYDotYTmlpnmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMToxMjowOSIsDQogICAibm90ZSI6ICLljbjovb0gXCLkurrlipvotYTmupDmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMToxMjowOSIsDQogICAibm90ZSI6ICLljbjovb0gXCLns7vnu5/kuovku7bmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMToxMjowOSIsDQogICAibm90ZSI6ICLljbjovb0gXCLlhazlhbHkuovku7bmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMToxMjowOSIsDQogICAibm90ZSI6ICLljbjovb0gXCLkuovku7bnrqHnkIbmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6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gICJub3RlIjogIuWNuOi9vSBcIuWQjuWPsOeuoeeQhuaooeWdl1wiIOaIkOWKn+OAgiINCiAgfSx7DQogICAidHlwZSI6ICJpbmZvIiwNCiAgICJ0aW1lIjogIjEyOjA1OjIyIiwNCiAgICJub3RlIjogIuWNuOi9vSBcIkh0dHBTZXJ2ZXLmnI3liqHmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNToyMiIsDQogICAibm90ZSI6ICLljbjovb0gXCLkvJror53nrqHnkIbmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNToyMiIsDQogICAibm90ZSI6ICLljbjovb0gXCLmlbDmja7lupPov57mjqXmsaDmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNToyMiIsDQogICAibm90ZSI6ICLljbjovb0gXCLphY3nva7mlofku7bmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNTozOCIsDQogICAibm90ZSI6ICLliqDovb0gXCLphY3nva7mlofku7bmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNTozOCIsDQogICAibm90ZSI6ICLliqDovb0gXCLmlbDmja7lupPov57mjqXmsaDmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNTozOCIsDQogICAibm90ZSI6ICLliqDovb0gXCLkvJror53nrqHnkIbmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNTozOCIsDQogICAibm90ZSI6ICLliqDovb0gXCLlkI7lj7DnrqHnkIbmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNTozOCIsDQogICAibm90ZSI6ICLliqDovb0gXCLlhazlhbHkuovku7bmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNTozOCIsDQogICAibm90ZSI6ICLliqDovb0gXCLns7vnu5/kuovku7bmqKHlnZdcIiDmiJDlip/jgIIiDQogIH0sew0KICAgInR5cGUiOiAiaW5mbyIsDQogICAidGltZSI6ICIxMjowNTozOCIsDQogICAibm90ZSI6ICLliqDovb0gXCLkurrlipvotYTmupDmqKHlnZdcIiDmiJDlip/jgIIiDQogIH1dLA0KICJzdGF0ZSI6IHsNCiAgInJldHVybiI6ICJ0cnVlIiwNCiAgImluZm8iOiAiIiwNCiAgImNvZGUiOiAiIg0KIH0NCn0=
      

  14.   

    json中除了单引号,还有其他的,好像是换行符,我晕死了。
    {
     "pageinfo": {
      "pagenumber": 2,
      "pagesize": 50,
      "pagecount": 35
     },
     "loglist": [
      {
       "type": "info",
       "time": "11:12:07",
       "note": "加载 \"事件管理模块\" 块成功。"
      },{
       "type": "info",
       "time": "11:12:07",
       "note": "加载 \"Http代理模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:07",
       "note": "加载 \"HttpServer服务模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"Http代理模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"销售订单模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"客户供应商模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"基础资料模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"人力资源模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"系统事件模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"公共事件模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"事件管理模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"后台管理模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"HttpServer服务模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"会话管理模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"数据库连接池模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:09",
       "note": "卸载 \"配置文件模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"配置文件模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"数据库连接池模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"会话管理模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"后台管理模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"公共事件模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"系统事件模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"人力资源模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"基础资料模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"客户供应商模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"销售订单模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"事件管理模块\" 块成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"Http代理模块\" 成功。"
      },{
       "type": "info",
       "time": "11:12:12",
       "note": "加载 \"HttpServer服务模块\" 成功。"
      },{
       "type": "error",
       "time": "11:19:15",
       "note": "执行客户端 192.168.0.235 的请求 \"\/hrms\/empctrl\/getemployeelist.do\" 发生出错。错误信息: 过程或函数 'proc_EmpBaseInfoPaging' 需要参数 '@RecordCount',但未提供该参数。"
      },{
       "type": "error",
       "time": "11:24:03",
       "note": "执行客户端 192.168.0.235 的请求 \"\/hrms\/empctrl\/getemployeelist.do\" 发生出错。错误信息: Leve desc ,OrgCode desc ,SortId desc ,EmpId desc"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"Http代理模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"销售订单模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"客户供应商模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"基础资料模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"人力资源模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"系统事件模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"公共事件模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"事件管理模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"后台管理模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"HttpServer服务模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"会话管理模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"数据库连接池模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:22",
       "note": "卸载 \"配置文件模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:38",
       "note": "加载 \"配置文件模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:38",
       "note": "加载 \"数据库连接池模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:38",
       "note": "加载 \"会话管理模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:38",
       "note": "加载 \"后台管理模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:38",
       "note": "加载 \"公共事件模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:38",
       "note": "加载 \"系统事件模块\" 成功。"
      },{
       "type": "info",
       "time": "12:05:38",
       "note": "加载 \"人力资源模块\" 成功。"
      }],
     "state": {
      "return": "true",
      "info": "",
      "code": ""
     }
    }
    这个应该是换行符的,怎么去掉啊?
      

  15.   

    用正则表达式:
    $str = preg_replace('/\r|\n/','', $str);
    网上搜的
      

  16.   

    这样就可以了
    $s = file_get_contents('json_data.txt');
    $s = preg_replace("/[\r\n]/", '', $s);
    print_r(json_decode($s));