我有一个有效的脚本,这个:
$output = $crud->render();
$data = array();
$data['title'] = 'Invoice details';
$output->data = $data;
$this->output($output); /* crud render and extra fields */
问题是这个脚本正在控制器中打开一个函数:
public function output($output = null) {
$this->load->view('template.php', $output);
}
和模板文件是这样的:(以及更多)
<title><?php echo ucfirst($data['title']); ?></title>
奇迹般有效。
模板文件正在加载页眉和页脚以及一堆 CSS
当我想打开发票时,我不想打开模板,只需要 invoice.php
所以我创建了这个:
public function invoice_print() {
$data = array();
$data['company'] = 'test';
$this->load->view('invoice.php', $data);
}
当我打开页面时出现错误:
遇到 PHP 错误 严重性:通知消息:未定义变量:数据文件名:views/invoice.php 行号:16
invoice.php 第 16 行 = 这个:
<p class="bold"> <?php echo $data['company']; ?> </p>
我该如何解决?
问候,
拉尔夫