라이브러리
[PHP] SwooleTable::current - 현재 행을 가져옵니다.
SwooleTable::current
SwooleTable은 Swoole 프레임워크에서 제공하는 테이블 데이터베이스입니다. SwooleTable::current는 현재 테이블의 현재 행을 반환하는 메서드입니다.
# 사용법
SwooleTable::current는 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$table = new SwooleTable(100, 3);
$table->column(0, 'int', 0);
$table->column(1, 'string', 50);
$table->column(2, 'int', 0);
// 데이터 삽입
$table->set(1, array(1, 'hello', 1));
// 현재 행 반환
$currentRow = $table->current();
echo $currentRow[0]; // 1
echo $currentRow[1]; // hello
echo $currentRow[2]; // 1
# 예제
다음 예제는 SwooleTable::current를 사용하여 현재 행을 반환하는 예제입니다.
#hostingforum.kr
php
$table = new SwooleTable(100, 3);
$table->column(0, 'int', 0);
$table->column(1, 'string', 50);
$table->column(2, 'int', 0);
// 데이터 삽입
$table->set(1, array(1, 'hello', 1));
// 현재 행 반환
$currentRow = $table->current();
// 현재 행의 값을 변경
$currentRow[1] = 'world';
$table->update(1, $currentRow);
// 현재 행 반환
$currentRow = $table->current();
echo $currentRow[0]; // 1
echo $currentRow[1]; // world
echo $currentRow[2]; // 1
# 주의사항
SwooleTable::current는 현재 테이블의 현재 행을 반환합니다. 만약 테이블이 비어있다면 NULL을 반환합니다. 또한, 현재 행의 값을 변경하면 테이블의 데이터가 변경됩니다.
# 결론
SwooleTable::current는 현재 테이블의 현재 행을 반환하는 메서드입니다. 이 메서드를 사용하여 현재 행의 값을 변경하거나, 현재 행의 값을 반환할 수 있습니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.