Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有几种项目的分数形式,例如:
<option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option>
问题是可以通过萤火虫更改该值,即更正value="3"为value="30"- 我们将拥有 - 30,如何验证这样的表单?
value="3"
value="30"
$possible_values = array(1,2,3); $val = (int) $_POST['input']; if( !in_array( $val, $possible_values)){ //error }
if( in_array( $Int , range( $Min , $Max ) ) )
尝试这个