我有以下代码,它一直给我payment_method_id“Undefined index”错误,所以我检查了debug.log文件,它显示
2017-11-18 00:27:39 Debug: 7
2017-11-18 00:27:40 Debug:
似乎验证方法被调用了2次,并且第一次$ context ['data'] [payment_method_id]存在,但在那之后,第二次,它不再存在?谁知道如何解决这个问题?感谢
$validator->notEmpty('cc_expires', __('This field is required'),
function ($context) {
Log::write('debug', $context['data'][payment_method_id]);
if ($context ['data'] ['payment_method_id'] == 1 )
{
return true;
}}
);