&reftitle.examples;
验证 使用 <function>filter_var</function> 验证电子邮件地址 ]]> &example.outputs; 使用 <function>filter_var</function> 验证 IP 地址 ]]> &example.outputs; 传递选项到 <function>filter_var</function> array( 'min_range' => 0, 'max_range' => 3, ) ); if (filter_var($int_a, FILTER_VALIDATE_INT, $options) !== FALSE) { echo "Integer A '$int_a' is considered valid (between 0 and 3).\n"; } if (filter_var($int_b, FILTER_VALIDATE_INT, $options) !== FALSE) { echo "Integer B '$int_b' is considered valid (between 0 and 3).\n"; } if (filter_var($int_c, FILTER_VALIDATE_INT, $options) !== FALSE) { echo "Integer C '$int_c' is considered valid (between 0 and 3).\n"; } $options['options']['default'] = 1; if (($int_c = filter_var($int_c, FILTER_VALIDATE_INT, $options)) !== FALSE) { echo "Integer C '$int_c' is considered valid (between 0 and 3)."; } ?> ]]> &example.outputs;
清理 清理和验证电子邮件地址 ]]> &example.outputs;