我是neo4j的新手。
我想使用密码查询检索节点的自动生成的id。
我正在使用php。
怎么可能? 另外,如何在php变量中获得节点的id?
答案 0 :(得分:2)
MATCH (n)
RETURN ID(n) as nodeId
请参阅文档:http://docs.neo4j.org/chunked/milestone/query-functions-scalar.html#functions-id
修改强>
我不太了解PHP,但假设您正在使用neo4jphp
,我想一般的想法就像是
$client = new Everyman\Neo4j\Client();
$queryString = "MATCH (n) RETURN ID(n) as nodeId";
$query = new Everyman\Neo4j\Cypher\Query($client, $queryString);
$result = $query->getResultSet();
echo $result[0]['nodeId']
您需要阅读neo4jphp
here,特别是how to use cypher。或者您可以将php cURL与Neo4j REST API一起使用。