src/models/Schema.php
public function getAutoIncrementNumber($tableName)
    {
        $data = $this->db->createCommand("SHOW CREATE TABLE {$tableName}")->queryAll();
        $startPosition = (int) strpos($data[0]['Create Table'], 'AUTO_INCREMENT=');
        $endPosition = (int) strpos($data[0]['Create Table'], 'DEFAULT CHARSET=');

        return $startPosition && $endPosition ? (int) substr($data[0]['Create Table'], $startPosition + 15, $endPosition - $startPosition - 1) : 0;
    }
public function getAutoIncrementNumber($tableName)
    {
        $data = $this->db->createCommand("SHOW CREATE TABLE {$tableName}")->queryAll();
        $startPosition = (int) strpos($data[0]['Create Table'], 'AUTO_INCREMENT=');
        $endPosition = (int) strpos($data[0]['Create Table'], 'DEFAULT CHARSET=');

        return $startPosition && $endPosition ? (int) substr($data[0]['Create Table'], $startPosition + 15, $endPosition - $startPosition - 1) : 0;
    }
获取表自动增长的起始位置
@param string $tableName 表名称，带前缀
@return int