Php 不正确的JSON、字符编码或无法识别的文件格式

Php 不正确的JSON、字符编码或无法识别的文件格式,php,json,magento,serialization,character-encoding,Php,Json,Magento,Serialization,Character Encoding,我使用的是Magento,这个特定的值应该是我可以解析的有效json。字符编码似乎出了问题。我明白了 a:10:{s:4:"type";s:10:"image/jpeg";s:5:"title";s:25:"the-goose-will-attack.jpg";s:10:"quote_path";s:68:"/media/custom_options/quote/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg";s:10:"order_path";s:68:"/

我使用的是Magento,这个特定的值应该是我可以解析的有效json。字符编码似乎出了问题。我明白了

a:10:{s:4:"type";s:10:"image/jpeg";s:5:"title";s:25:"the-goose-will-attack.jpg";s:10:"quote_path";s:68:"/media/custom_options/quote/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg";s:10:"order_path";s:68:"/media/custom_options/order/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg";s:8:"fullpath";s:102:"/var/www/mageprodcory/mage-webroot/media/custom_options/quote/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg";s:4:"size";s:5:"42421";s:5:"width";i:450;s:6:"height";i:600;s:10:"secret_key";s:20:"94b0992d58b4478d13a2";s:3:"url";a:2:{s:5:"route";s:35:"sales/download/downloadCustomOption";s:6:"params";a:2:{s:2:"id";s:3:"133";s:3:"key";s:20:"94b0992d58b4478d13a2";}}}
它看起来几乎像是有效的json,但是
;s:25:
这类东西不属于你。它应该是json,但我想它也可以是其他文件格式

我在
上找不到任何字符编码信息;s:25:
键入字符,主要是因为很难搜索。我试过禁用魔法引号,但这不是原因


你知道为什么JSON不正确,或者这个文本是什么文件格式,以及我如何用PHP解析它吗?

这个字符串不是JSON。它是序列化的值。运行以下代码:

<?php

var_dump(unserialize('a:10:{s:4:"type";s:10:"image/jpeg";s:5:"title";s:25:"the-goose-will-attack.jpg";s:10:"quote_path";s:68:"/media/custom_options/quote/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg";s:10:"order_path";s:68:"/media/custom_options/order/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg";s:8:"fullpath";s:102:"/var/www/mageprodcory/mage-webroot/media/custom_options/quote/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg";s:4:"size";s:5:"42421";s:5:"width";i:450;s:6:"height";i:600;s:10:"secret_key";s:20:"94b0992d58b4478d13a2";s:3:"url";a:2:{s:5:"route";s:35:"sales/download/downloadCustomOption";s:6:"params";a:2:{s:2:"id";s:3:"133";s:3:"key";s:20:"94b0992d58b4478d13a2";}}}'));

这很好用。我已经在magento.stackexchange上交叉发布了我问题的答案。如果这是个问题,请告诉我。
array(10) {
  ["type"]=>
  string(10) "image/jpeg"
  ["title"]=>
  string(25) "the-goose-will-attack.jpg"
  ["quote_path"]=>
  string(68) "/media/custom_options/quote/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg"
  ["order_path"]=>
  string(68) "/media/custom_options/order/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg"
  ["fullpath"]=>
  string(102) "/var/www/mageprodcory/mage-webroot/media/custom_options/quote/t/h/94b0992d58b4478d13a2376f645d3b7c.jpg"
  ["size"]=>
  string(5) "42421"
  ["width"]=>
  int(450)
  ["height"]=>
  int(600)
  ["secret_key"]=>
  string(20) "94b0992d58b4478d13a2"
  ["url"]=>
  array(2) {
    ["route"]=>
    string(35) "sales/download/downloadCustomOption"
    ["params"]=>
    array(2) {
      ["id"]=>
      string(3) "133"
      ["key"]=>
      string(20) "94b0992d58b4478d13a2"
    }
  }
}