함수의 mysqli 변수에서 if 문을 컴파일하려고하는데`117 번 줄의 객체 컨텍스트가 아닐 때 $ using this를 사용하는 중대한 오류가 발생합니다. 나는 잘못하고 어떻게 if 문을 함수에서 사용할 수 있습니까?
코드 :
$qandaquery = "SELECT ReplyType
FROM Reply";
$qandaqrystmt=$mysqli->prepare($qandaquery);
// get result and assign variables (prefix with db)
$qandaqrystmt->execute();
$qandaqrystmt->bind_result($qandaReplyType);
$this->shared_result[] = $qandaReplyType; //ERROR HERE
function ExpandOptionType($option) {
if('Single' == $this->shared_result){
...
}else if('Multiple' == $this->shared_result){
...
}
}
여기서'$ this'는 무엇을 의미합니까? – deceze
이 영역에는 수업이 없으므로 $ this가 작동하지 않습니다. shared_result 배열의 초기화는 어디에서 할 수 있습니까? 이 파편도 게시 할 수 있습니까? – Shimu
나는 숙제를 올리는 대신에 의미있는 부분을 추출하여 올바르게 질문하는 것에 대해 함수 –