[英]How do I use the GFAPI class from Gravity Forms?
How do I use the GFAPI class from Gravity Forms?如何使用 Gravity Forms 中的 GFAPI 类? I want to get all the entries from a given form.我想从给定的表单中获取所有条目。 But nothing seems to work.. Do I need to import/include/require the class?但似乎没有任何效果..我需要导入/包含/要求类吗?
<?php
getEntries();
function getEntries() {
$form_id = 73;
$search_criteria = array();
$entries = GFAPI::get_entries($form_id, $search_criteria);
exit(var_dump($entries));
}
When I open the file, it doens't work, and I have a feeling it's because it can't find the class.当我打开文件时,它不起作用,我有一种感觉是因为它找不到类。
In the GF docs, it says: "The API Functions are automatically included when Gravity Forms loads and they will be available by the time add-ons load. The API class is called GFAPI and it can be found in /plugins/gravityforms/includes/api.php.".在 GF 文档中,它说:“加载 Gravity Forms 时会自动包含 API 函数,并且它们将在加载项加载时可用。API 类称为 GFAPI,可以在 /plugins/gravityforms/includes 中找到/api.php。”。
$entries = GFAPI::get_entries( '73' ); $entries = GFAPI::get_entries('73');
It probably isn't working due to the $search_criteria variable.由于 $search_criteria 变量,它可能不起作用。 If no results are found with your search, you won't get any results.如果您的搜索未找到任何结果,您将不会获得任何结果。 The parameter is optional.该参数是可选的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.