php $_POST计数问题

什么是获得$_POST计数的最佳方法

我有一个用户可以创建输入框的表单,所以我不想允许空提交.

我试过计数($_ POST),它总是空的.这个

if(!isset($_POST['submit'])) {
//codes
}
else {
die(count($_POST)); // return as empty
}

什么是获得$_POST数量的最佳方法

解决方法:

请注意,它是一个整数,你传递给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
}

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...