我下面的codeigniter代码我正在处理pdf文件,当我执行它时,你好世界只显示而不是表格请帮助我解决问题。我把控制器放在下面。我从这个网站下载 http://www。 christophermonnat.com/2008/08/generating-pdf-files-using-codeigniter/
控制器:
<?php
class Tutorial extends controller
{
function Tutorial()
{
parent::Controller();
$this->load->helper('url');
}
function index()
{
$this->hello_world();
}
function hello_world()
{
$this->load->library('cezpdf');
$this->cezpdf->ezText('Hello World', 12, array('justification' => 'center'));
$this->cezpdf->ezSetDy(-10);
$content = 'The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog.
Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs.';
$this->cezpdf->ezText($content, 10);
$this->cezpdf->ezStream();
}
function tables()
{
$this->load->library('cezpdf');
$db_data[] = array('name' => 'Jon Doe', 'phone' => '111-222-3333', 'email' => 'jdoe@someplace.com');
$db_data[] = array('name' => 'Jane Doe', 'phone' => '222-333-4444', 'email' => 'jane.doe@something.com');
$db_data[] = array('name' => 'Jon Smith', 'phone' => '333-444-5555', 'email' => 'jsmith@someplacepsecial.com');
$col_names = array(
'name' => 'Name',
'phone' => 'Phone Number',
'email' => 'E-mail Address'
);
$this->cezpdf->ezTable($table_data, $col_names, 'Contact List', array('width'=>550));
$this->cezpdf->ezStream();
}
function headers()
{
$this->load->library('cezpdf');
$this->load->helper('pdf');
prep_pdf(); // creates the footer for the document we are creating.
$db_data[] = array('name' => 'Jon Doe', 'phone' => '111-222-3333', 'email' => 'jdoe@someplace.com');
$db_data[] = array('name' => 'Jane Doe', 'phone' => '222-333-4444', 'email' => 'jane.doe@something.com');
$db_data[] = array('name' => 'Jon Smith', 'phone' => '333-444-5555', 'email' => 'jsmith@someplacepsecial.com');
$col_names = array(
'name' => 'Name',
'phone' => 'Phone Number',
'email' => 'E-mail Address'
);
$this->cezpdf->ezTable($db_data, $col_names, 'Contact List', array('width'=>550));
$this->cezpdf->ezStream();
}
}
?>