【发布时间】:2015-04-27 07:26:13
【问题描述】:
我收到错误参数映射不能在 MERGE 模式中使用。如何解决此错误。我正在使用下面的代码。非常感谢任何帮助。在此先感谢。
'MERGE (u:Person {names}) RETURN u ';
和
$data2='{
"names" : [{
"name" : "Keanu Reeves1",
"role" : "Neo1"
},
{
"name" : "Keanu Reeves2",
"role" : "Neo2"
},
{
"name" : "Keanu Reeves3",
"role" : "Neo3"
}]
}';
完整代码:
<?php
$data2='{
"names" : [{
"name" : "Keanu Reeves1",
"role" : "Neo1"
},
{
"name" : "Keanu Reeves2",
"role" : "Neo2"
},
{
"name" : "Keanu Reeves3",
"role" : "Neo3"
}]
}';
$data ='MERGE (u:Person {names}) RETURN u';
$data2=json_decode($data2);
$data = array("query" =>$data,"params"=>$data2 );
$data_string = json_encode($data);
print_r($data_string);
//print_r($data2);
$ch = curl_init('http://192.....:7474/db/data/cypher');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
print_r ($ch);
$result = curl_exec($ch);
print_r($result);
?>
【问题讨论】: