HTML 테이블 업그레이드
문서
변경된 사항
메서드 이름과 라이브러리 로드 방법과 같은 소소한 부분만 변경되었습니다.
업그레이드 가이드
클래스 내에서
$this->load->library('table');을$table = new \CodeIgniter\View\Table();로 변경하십시오.그 이후
$this->table로 시작하는 모든 줄을$table로 교체해야 합니다. 예를 들어:echo $this->table->generate($query);은echo $table->generate($query);가 됩니다.HTML 테이블 클래스의 메서드 이름이 약간 다를 수 있습니다. 가장 중요한 이름 변경은 밑줄 메서드 이름에서 camelCase로의 전환입니다. 버전 3의
set_heading()메서드는 이제setHeading()이 되는 식입니다.
코드 예제
CodeIgniter 버전 3.x
<?php
$this->load->library('table');
$this->table->set_heading('Name', 'Color', 'Size');
$this->table->add_row('Fred', 'Blue', 'Small');
$this->table->add_row('Mary', 'Red', 'Large');
$this->table->add_row('John', 'Green', 'Medium');
echo $this->table->generate();
CodeIgniter 버전 4.x
<?php
$table = new \CodeIgniter\View\Table();
$table->setHeading('Name', 'Color', 'Size');
$table->addRow('Fred', 'Blue', 'Small');
$table->addRow('Mary', 'Red', 'Large');
$table->addRow('John', 'Green', 'Medium');
echo $table->generate();