Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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
通过contentful管理php sdk使用RichText数据创建条目_Php_Rtf_Richtext_Contentful_Contentful Management - Fatal编程技术网

通过contentful管理php sdk使用RichText数据创建条目

通过contentful管理php sdk使用RichText数据创建条目,php,rtf,richtext,contentful,contentful-management,Php,Rtf,Richtext,Contentful,Contentful Management,我已经广泛地搜索了这个问题的答案,联系了心满意足的支持人员(并且被忽略了),并尝试了我能想到的每一种排列方式。任何帮助都将不胜感激 我想通过带有RichText内容的contentful management sdk创建一个新条目 设定者: $entry->setField('rtf', 'en-GB', file_get_contents('content-blocks/rtf/zzz.rtf')); { "nodeType": "document", "data": {},

我已经广泛地搜索了这个问题的答案,联系了心满意足的支持人员(并且被忽略了),并尝试了我能想到的每一种排列方式。任何帮助都将不胜感激

我想通过带有RichText内容的contentful management sdk创建一个新条目

设定者:

$entry->setField('rtf', 'en-GB', file_get_contents('content-blocks/rtf/zzz.rtf'));
{
  "nodeType": "document",
  "data": {},
  "content": [
    {
      "nodeType": "paragraph",
      "content": [
        {
          "nodeType": "text",
          "value": "Test text",
          "marks": [],
          "data": {}
        }
      ],
      "data": {}
    }
  ]
}
{\n
  "sys": {\n
    "type": "Error",\n
    "id": "InvalidEntry"\n
  },\n
  "message": "Validation error",\n
  "details": {\n
    "errors": [\n
      {\n
        "name": "type",\n
        "value": "{\n  \"nodeType\": \"document\",\n  \"data\": {},\n  \"content\": [\n    {\n      \"nodeType\": \"paragraph\",\n      \"content\": [\n        {\n          \"nodeType\": \"text\",\n          \"value\": \"Test text\",\n          \"marks\": [],\n          \"data\": {}\n        }\n      ],\n      \"data\": {}\n    }\n  ]\n}\n",\n
        "type": "RichText",\n
        "details": "The type of \"value\" is incorrect, expected type: RichText",\n
        "path": [\n
          "fields",\n
          "rtf",\n
          "en-US"\n
        ]\n
      }\n
    ]\n
  },\n
  "requestId": "a603e57d716b7af9c5c8078f2701fc41"\n
}\n
该文件的内容为:

$entry->setField('rtf', 'en-GB', file_get_contents('content-blocks/rtf/zzz.rtf'));
{
  "nodeType": "document",
  "data": {},
  "content": [
    {
      "nodeType": "paragraph",
      "content": [
        {
          "nodeType": "text",
          "value": "Test text",
          "marks": [],
          "data": {}
        }
      ],
      "data": {}
    }
  ]
}
{\n
  "sys": {\n
    "type": "Error",\n
    "id": "InvalidEntry"\n
  },\n
  "message": "Validation error",\n
  "details": {\n
    "errors": [\n
      {\n
        "name": "type",\n
        "value": "{\n  \"nodeType\": \"document\",\n  \"data\": {},\n  \"content\": [\n    {\n      \"nodeType\": \"paragraph\",\n      \"content\": [\n        {\n          \"nodeType\": \"text\",\n          \"value\": \"Test text\",\n          \"marks\": [],\n          \"data\": {}\n        }\n      ],\n      \"data\": {}\n    }\n  ]\n}\n",\n
        "type": "RichText",\n
        "details": "The type of \"value\" is incorrect, expected type: RichText",\n
        "path": [\n
          "fields",\n
          "rtf",\n
          "en-US"\n
        ]\n
      }\n
    ]\n
  },\n
  "requestId": "a603e57d716b7af9c5c8078f2701fc41"\n
}\n
我还尝试过直接输入内容、去除空白等。这个json块也是由Contentful自己的标记到richtext转换器生成的

响应:

$entry->setField('rtf', 'en-GB', file_get_contents('content-blocks/rtf/zzz.rtf'));
{
  "nodeType": "document",
  "data": {},
  "content": [
    {
      "nodeType": "paragraph",
      "content": [
        {
          "nodeType": "text",
          "value": "Test text",
          "marks": [],
          "data": {}
        }
      ],
      "data": {}
    }
  ]
}
{\n
  "sys": {\n
    "type": "Error",\n
    "id": "InvalidEntry"\n
  },\n
  "message": "Validation error",\n
  "details": {\n
    "errors": [\n
      {\n
        "name": "type",\n
        "value": "{\n  \"nodeType\": \"document\",\n  \"data\": {},\n  \"content\": [\n    {\n      \"nodeType\": \"paragraph\",\n      \"content\": [\n        {\n          \"nodeType\": \"text\",\n          \"value\": \"Test text\",\n          \"marks\": [],\n          \"data\": {}\n        }\n      ],\n      \"data\": {}\n    }\n  ]\n}\n",\n
        "type": "RichText",\n
        "details": "The type of \"value\" is incorrect, expected type: RichText",\n
        "path": [\n
          "fields",\n
          "rtf",\n
          "en-US"\n
        ]\n
      }\n
    ]\n
  },\n
  "requestId": "a603e57d716b7af9c5c8078f2701fc41"\n
}\n
此场景的文档不存在,因此,如果您能提供任何帮助,我们将不胜感激