假定数据为DATA_ARRAY

const DATA_ARRAY = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'];

分页操作

//分页数
$current_page = $_GET['current_page'] ?? 1;

//每页显示数量
$perPage = 5;

//获取记录总数
$total_records = count(DATA_ARRAY);

//获取分页总数
$total_pages = ceil($total_records / $perPage);

//当前位置
$current = ($current_page - 1) * $perPage;

//输出内容
$output = array_slice(DATA_ARRAY, $current, $perPage);
echo '<pre>';
print_r($output);
echo '</pre>';

// 分页导航
echo paginate_links(array(
    //'base' => add_query_arg('current_page', '%#%'),
    'format' => '?current_page=%#%',
    'prev_text' => '&laquo;',
    'next_text' => '&raquo;',
    'total' => $total_pages,
    'current' => $current_page,
));

状态栏

$records = min((int) $perPage, $total_records);
$count = ($current_page - 1) * $records;
$post_count = min((int) $current_page * $perPage, $total_records);
echo '<div class="guest-records-count">共' . $total_records . '条 | 当前第' . ($count + 1) . '至' . $post_count . '条</div>';

上面的代码输出如下:

Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
)
1 2 3 … 5 »
共24条 | 当前第1至5条