我知道节点标题,我想从节点标题中获取节点 ID,我尝试了 2 种方法但无法正常工作
1)
$title = arg(2); // get node title from the url
$node = node_load(array('title' => $title));
$nid = $node->nid;
print $nid;
错误是说 Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load()
,Trying to get property of non-object
2)
$items = entity_load('node', FALSE, array(
'type' => 'article',
'title' => arg(2),
));
但那我该怎么办?