[ERROR] Warning: count(): Parameter must be an array or an object that implements Countable in

gyrud02·2022년 2월 4일
0

오류(ERROR)

목록 보기
18/27
Warning: count(): Parameter must be an array or an object that implements Countable in

$it_cp_cnt = count($_POST['cp_id']);

count 함수는 위의 에러와 같이 배열형식이거나 오브젝트일때만 사용가능한 함수이다. php 7 버전 이후로부터는 문법에 엄격해졌기 때문에 해당 함수를 경고 없이 사용하려면 해당 함수인 $i = array(); 와 같이 초기화 선언이 있어야한다.

  • 위 코드를 아래 코드로 수정한 후 해결하였다.
$it_cp_cnt = is_array($_POST['cp_id']);
profile
Back-End Engineer

0개의 댓글