
SwooleTable::decr 함수는 SwooleTable의 특정 키의 값을 감소시키는 함수입니다.
#hostingforum.kr
php
$table = new SwooleTable(1024, 4);
$table->column('count', SwooleTable::TYPE_INT);
$table->create();
$table->set('key', ['count' => 10]);
echo $table->decr('key', 'count'); // 9
echo $table->get('key', ['count']); // 9
SwooleTable::decr 함수에서 오류가 발생하는 경우를 처리하려면 try-catch 블록을 사용하여 예외를 잡아야 합니다.
#hostingforum.kr
php
$table = new SwooleTable(1024, 4);
$table->column('count', SwooleTable::TYPE_INT);
$table->create();
try {
$table->decr('key', 'count');
} catch (SwooleTableException $e) {
echo '오류 발생: ' . $e->getMessage();
}
2025-05-12 02:35