【发布时间】:2020-09-09 10:36:00
【问题描述】:
我正在尝试在提交表单之前打印日期值,但它没有打印任何内容并提交了表单,下面是我的代码
function webforms_save_submission_alter(&$fields, $context)
{
foreach ($fields as $key => $value) {
if (in_array($key, ["Date_Prototype__c", "Date_Production__c", "NBIOT_Date_of_Field_Trial__c", "NBIOT_Date_Lab_Trial__c"])){
$fields[$key] = trim($value);
print_r($fields); // printing here
if ($fields[$key] == 'Date_Production__c') {
$fields[$key] = format_date(strtotime($fields['Date_Production__c']), 'medium', 'm-d-Y');
print_r($fields); // printing here
die;
}
我想在提交表单之前查看日期反应,但为什么它没有打印任何内容?有人可以帮我吗? 非常感谢您的帮助..
【问题讨论】:
-
你的问题不是很清楚!
-
出于兴趣尝试
echo $fields[$key];甚至print_r($fields, true); -
echo 或 print_r ?
-
我应该尝试什么应该与 print_r 一起去?
-
在每个条件之前和之后添加更多
die语句,并在每个条件中使用不同的文本,以查看您的代码是否实际运行,如果是,您的条件是否准确。