致命错误:无法将stdClass类型的对象用作函数array_push中的数组

时间:2018-07-10 17:43:26

标签: codeigniter

我想收集多个复选框值进行处理,但是我知道了 错误=致命错误:无法在此

中使用类型为 int arrLength = 424; // your input int sections = 5;// your input int minSize = arrLength / sections; // minimum size of array int reminder = arrLength % sections; // we need to distribute the reminder to sub arrays int maxSize = minSize + 1; // maximum size of array int subArrIndex = 1; // lets print sub arrays with maximum size which will be equal to reminders while (reminder > 0 && subArrIndex <= sections ) { Console.WriteLine(string.Format("SubArray #{0}, Start - {1}, End - {2}", subArrIndex, ((subArrIndex-1)*maxSize), (subArrIndex*maxSize-1))); reminder--; subArrIndex++; } // lets print remaining arrays while (subArrIndex <= sections) { Console.WriteLine(string.Format("SubArray #{0}, Start - {1}, End - {2}", subArrIndex, ((subArrIndex - 1) * minSize), (subArrIndex * minSize - 1))); subArrIndex++; } 的对象作为数组
stdClass

1 个答案:

答案 0 :(得分:0)

$ panyakit是您尝试访问的实际数组还是对象?

如果它是一个对象,请尝试按以下方式访问它:

 $penyakit->kode_penyakit