itsource

매개 변수는 phpmyadmin에서 카운트 가능을 구현하는 어레이 또는 개체여야 합니다.

mycopycode 2023. 3. 18. 08:36
반응형

매개 변수는 phpmyadmin에서 카운트 가능을 구현하는 어레이 또는 개체여야 합니다.

phpmyadmin에서 wp_posts 테이블을 표시하려고 하면 이 에러 메시지가 표시되지만, 그 의미를 알지 못하고 지금까지 본 적이 없습니다.

어떻게 해서든 이걸 없앨 수 있는 사람 없나요?

Warning in ./libraries/sql.lib.php#613
count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/sql.lib.php#2128: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#2079: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'afterhours',
string 'wp_posts',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/original/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `wp_posts`',
NULL,
NULL,
)
./sql.php#221: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'afterhours',
string 'wp_posts',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/original/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `wp_posts`',
NULL,
NULL,
)

이것은 phpmyadmin - count()의 중복으로 보입니다.파라미터는 카운트 가능을 구현하는 어레이 또는 객체여야 합니다.

링크된 게시물의 상위 답변에 따르면 ./libraries/sql.lib에 오류가 있을 수 있습니다.php는 코드가 배열(또는 "카운터블"을 구현하는 개체)이 아닌 다른 것으로 count() 함수를 시도하도록 합니다.(링크된 응답에 따라) 수정하려면:

'/usr/share/phpmyadmin/libraries/sql.lib 파일을 편집합니다.php' 및 치환

(count($analyzed_sql_results['select_expr'] == 1) 

포함:

(count($analyzed_sql_results['select_expr']) == 1

이는 다음과 같은 이유로 동작합니다.

  • 비배열에서는 카운트를 수행할 수 없습니다(따라서 "매개변수는 카운터블을 구현하는 배열 또는 개체여야 합니다"라는 오류).
  • count()의 "== 1"은 동등성 테스트이며 배열이 아닙니다.
  • count()에서 "== 1"을 제거하면 count(array) 함수가 남으며, 이 함수는 작동합니다.

다음과 같이 is_array() 함수를 사용하여 실제로 어레이인지 검증하여 문제를 해결했습니다.

if (is_array($yourArray)) {
    //Your count()
}

언급URL : https://stackoverflow.com/questions/51109440/parameter-must-be-an-array-or-an-object-that-implements-countable-in-phpmyadmin

반응형