我有一些表单字段,当提交表单时会在 $_POST 中创建一个数组,我需要检查这个数组至少有 4 个键,我该如何检查?我不知道
最佳答案
尝试:
<?php
if(count($_POST) >= 4):
//Do your stuff
else:
//Do your error stuff
endif;
如果你想检查 $_POST 中的一个数组作为 $_POST 本身的对应使用
计数($_POST['name_of_key_to_array_you_want_to_count'])
关于PHP 检查 $_POST,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3069096/