1
讓我們假設驗證第一個數組是否正常,並返回表單或繼續像我們想要的那樣。我們想要對第二個數組進行驗證,以向用戶提供驗證消息,即輸入不在第一個數組中,而是在第二個數組中。我們如何回覆這個?如何根據一個數組驗證輸入,然後如果有必要針對另一個數組?
$var1s = array()
$var2s = array()
$form = $validation_result["form"];
$checkforthis = post('input_1')
//if the following is valid, return $validation_result and forget the rest
if($checkforthis && in_array($var1, $var1s))
return $validation_result;
//otherwise...
//how does one return the following and distinguish it from the above validation?
if($checkforthis && in_array($var2, $var2s))
return **whatgoeshere?**
//otherwise when NOT in either array
$field['failed_validation'] = true;
$field['validation_message'] = 'Please check and try again.';
說實話...我不明白你的問題。 – webbi 2011-01-26 19:12:48