什么是获得$_POST计数的最佳方法
我试过计数($_ POST),它总是空的.这个
if(!isset($_POST['submit'])) {
//codes
}
else {
die(count($_POST)); // return as empty
}
解决方法:
请注意,它是一个整数,你传递给die()(别名为exit()
)!这有一个特殊的含义:
If
status
[the argument] is an integer, that value
will be used as the exit status and
not printed. Exit statuses should be
in the range 0 to 254, the exit status
255 is reserved by PHP and shall not
be used. The status 0 is used to
terminate the program successfully.
(我的重点)
简单的解决方法:
if(!isset($_POST['submit'])) {
//codes
} else {
die('count=' . count($_POST)); // Now a String
}