PHP에서 프로젝트를 진행하고 있었고 배열을 문자열로 변환하는 중임을 알았습니다. 나는 주위에 방법이 있는지 궁금 해서요?알림 PHP에서 문자열 변환에 대한 배열
if(isset($_POST['acceptrequest' . $user_from])) {
$get_friend_check = mysql_query("SELECT friend_array FROM users WHERE username='$user'");
$get_friend_row = mysql_fetch_assoc($get_friend_check);
$friend_array = $get_friend_row['friend_array'];
$friendArray_explode = explode(",",$friend_array);
echo $friendArray_explode;
}
SQL 인젝션 취약점이 있습니다. – SLaks
'echo $ friendArray_explode;'explode()'를 호출하면'$ friendArray_explode'에 배열이 반환되고, 그 문자열을 마치 문자열처럼 에코하려고 시도합니다. –
결과를 보려고하는 경우 var_dump ($ friendArray_explode). 실제로 코드에 몇 가지 문제가 있습니다. 더 이상 사용되지 않는 오래된 MySQL 명령을 활용하고 있습니다. 대신 mysqli 명령으로 전환해야한다. (http://www.php.net//manual/en/migration55.deprecated.php). 준비된 명령문 (http://www.php.net//manual/en/mysqli.quickstart.prepared-statements.php) 대신 쿼리를 연결하여 SQL 인젝션을 수행 할 수 있습니다 공격, 당신이 엄격하게 제어하지 않는 한 $ 사용자. 희망이 도움이됩니다. – IrishGeek82