很简单但让我很困惑!就这个:
$command[] = "30";
$command[] = "20";
$command[] = "10";
$command[] = "5";
$command[] = "1";
asort($command);
print_r($command);
返回:
数组([0] => 数组([0] => 30 [1] => 20 [2] => 10 [3] => 5 [4] => 1))
但我想要:
数组([0] => 数组([0] => 1 [1] => 5 [2] => 10 [3] => 20 [4] => 30))
我使用的确切代码:
$cmd_id = array();
foreach ($_POST as $k => $v)
{
if($k=='cmd_id' && $v>0)
$cmd_id[] = $v;
}
表单是多个复选框:
<input type="checkbox" name="cmd_id[]" .........