id = LfasrConstants::ORIGIN_SLICE_ID; } /** * 返回当前切片ID,并生成下一个切片ID,赋值给对象的当前ID * * @return string */ public function getId() { $currentId = $this->id; $nextId = $currentId; $pos = strlen($currentId) - 1; while ($pos >= 0) { $charAtPos = $nextId[$pos]; if ($charAtPos != 'z') { $nextId = substr($nextId, 0, $pos) . chr((ord($charAtPos) + 1)) . substr($nextId, $pos + 1); break; } else { $nextId = substr($nextId, 0, $pos) . 'a'; $pos = $pos - 1; } } $this->id = $nextId; return $currentId; } }