Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 以RGB格式保存颜色时出现JSON错误_Jquery_Json_Rgb - Fatal编程技术网

Jquery 以RGB格式保存颜色时出现JSON错误

Jquery 以RGB格式保存颜色时出现JSON错误,jquery,json,rgb,Jquery,Json,Rgb,我到处搜索都找不到答案,或者这只是我的json代码中的错误 JSON file: { "html": { "content": "<div style=\"background-color: rgb(255, 255, 255); height: 11px; width: 111px;\"></div>" } } background-color: rgb(255, 255, 255); --> NO background-color: #0000

我到处搜索都找不到答案,或者这只是我的json代码中的错误

JSON file:
{
  "html": {
    "content": "<div style=\"background-color: rgb(255, 255, 255); height: 11px; width: 111px;\"></div>"
  }
}

background-color: rgb(255, 255, 255); --> NO
background-color: #000000; --> OK
它不能保存为RGB格式吗


但是如果我使用十六进制格式,json文件就完全可以了

它看起来不像jsonfile@JimiDini很抱歉这只是json文件中的一段简短代码!还是不明白。您是如何从这个html字符串创建JSON的?显示确切的JSON示例。您对生成的JSON做了什么?您有什么错误?因为它似乎对我有用(至少在解码部分)
$jsonPathSite = '/site/01.json';
$jsonFileSite = file_get_contents($jsonPathSite);
$jsonReadSite = jsonDecode($jsonFileSite,true);

// Saving the file
$jsonReadSite['html']['content'] = $content;

file_put_contents( $jsonPathSite, json_encode($jsonReadSite) );