0
나는 MEMBERS라는 클래스를 만들었습니다. 이 클래스에서 배열을 멤버 변수로 선언했습니다. I는 I 배열해당 클래스의 개체를 통해 클래스 내부에 선언 된 배열에 액세스
foreach($user->arr_connections as $mem_id)
{
echo $mem_id;
$person = new member($mem_id);
echo "<a href = 'profile.php?id=$person->id'><img src = '$person->display_picture'/ width = 30 height = 30></a>";
}
에게 표시하고
$user->connections($user->id);
다음과 같은 기능을 호출하고,이 후
$user = new member();
을 따를
class member
{
public $arr_connections;
function connections($id)
{
$query = mysql_query("Select * from connections where user_id = '$id'");
while($info = mysql_fetch_array($query))
{
$arr_connections[] = $info['connection_id'];
}
}
}
그러면 I이 클래스의 객체를 생성 한
이것은 w가 아닙니다. orking. 나는 내 방법이 잘못되었다고 생각한다. 일부 생성자가 필요했습니다. 하지만 생성자없이이 작업을 수행해야합니다. 제안 사항이 있으십니까?
감사합니다. 지금 일하고있다. – Varun