개발자 Q&A

개발하다 막혔다면? 여기서 질문하세요! 초보부터 고수까지, 함께 고민하고 해결하는 공간입니다. 누구나 자유롭게 질문하고 답변을 남겨보세요!

2025.07.14 16:38

SwooleTable::current 사용 방법에 대한 질문

목록
  • 풀스택꿈나무 5일 전 2025.07.14 16:38
  • 84
    1
저는 SwooleTable::current를 사용하여 테이블의 현재 상태를 얻으려고 합니다. 하지만 이 메소드의 사용법을 이해하지 못하고 있습니다.

SwooleTable::current는 어떤 형태의 값을 반환하고, 사용하는 방법은 어떻게 되는지 알려주세요.

    댓글목록

    profile_image
    나우호스팅  5일 전



    SwooleTable::current는 현재 테이블의 행을 반환합니다.

    #hostingforum.kr
    php
    
    $table = new SwooleTable(10, 2);
    
    $table->column(0, ['name' => 'id', 'type' => SwooleTable::TYPE_INT]);
    
    $table->column(1, ['name' => 'name', 'type' => SwooleTable::TYPE_STRING, 'len' => 50]);
    
    
    
    $table->set('1', ['id' => 1, 'name' => 'John']);
    
    
    
    $currentRow = $table->current();
    
    echo $currentRow['id']; // 1
    
    echo $currentRow['name']; // John
    
    


    SwooleTable::current는 현재 테이블의 행을 반환하기 때문에, 테이블의 행을 수정하거나 삭제할 때 사용할 수 있습니다.

    #hostingforum.kr
    php
    
    $table->current()->update(['name' => 'Jane']);
    
    echo $table->current()['name']; // Jane
    
    

    2025-07-14 16:39

  • 개발자 Q&A 포인트 정책
      글쓰기
      50P
      댓글
      10P
  • 전체 37,368건 / 64 페이지

검색

게시물 검색