简体   繁体   English

如何使用 Gravity Forms 中的 GFAPI 类?

[英]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.

相关问题 如何从Gravity Forms条目对象获取复选框的值? - How do I get the value of a checkbox from the Gravity Forms Entry Object? 当 integer 在 Gravity Forms GFAPI::get_entries 过滤器中正常工作时,变量不起作用 - Variable not working when an integer works fine in Gravity Forms GFAPI::get_entries filter Phalcon:如何将自定义Validation类与表单一起使用? - Phalcon: How do I use my custom Validation class with forms? 如何显示我在重力表格用户注册中创建的自定义用户元字段? - How do I display the custom user meta fields I created in Gravity Forms User Registration? 如何强制重力表单中的大写字段条目以小写形式提交? - How do I force uppercase field entries in Gravity Forms to submit as lowercase? 如何创建自定义Gravity Forms Merge标记以显示输入日期和时间? - How do I create a custom Gravity Forms Merge Tag to display entry date and time? 计算重力表格中从“-”日期格式的多少年 - Calculating how many years from “from - to” date form in Gravity Forms 如何使用挂钩编辑重力形式? - How can I edit gravity forms using hooks? Gravity Forms正在验证隐藏字段,如何解决此问题? - Gravity Forms is validating hidden fields, how can I fix this? 如何从重力形式接收自定义脚本的POST数据 - How to receive POST data from gravity forms for custom script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM