我使用這個蛋糕幫手https://github.com/segy/PhpExcel,現在我有很多問題,因爲這樣的:我想生成一個excel在CakePHP的一個輔助
方法PhpExcelHelper :: createWorksheet不存在[CORE \蛋糕\ View \ Helper.php,192行] 方法PhpExcelHelper :: addTableHeader不存在[CORE \ Cake \ View \ Helper.php,第192行] 方法PhpExcelHelper :: addTableRow不存在[CORE \ Cake \ View \ Helper .php,line 192] 方法PhpExcelHelper :: addTableRow不存在[CORE \ Cake \ View \ Helper.php,第192行] 方法PhpExcelHelper :: addTableRow不存在[CORE \ Cake \ View \ Helper.php,line 192] 方法PhpExcelHelper :: addTableFooter不存在[CORE \ Cake \ View \ Helper.php,第192行] 缺少Helper :: output()的參數1,在C:\ Program Files \ PostgreSQL \ EnterpriseDB-ApachePHP \ apache中調用\ CORE \ Cake \ View \ Helper.php,第806行] \ www \ prueba \ app \ View \ Documentos \ index.ctp並且定義了一個未定義的變量:str [CORE \ Cake \ View \ Helper.php,line 807] 方法PhpExcelHelper ::出口不存在[CORE \蛋糕\視圖\ Helper.php,線192] 模型Documento.php
<?php
class Documento extends AppModel {
public $useTable = 'documento';
}
?>
控制器DocumentosController.php
<?php
class DocumentosController extends AppController {
public $helpers = array('Html', 'Form','PhpExcel.PhpExcel');
public function index() {
$this->set('documentos', $this->Documento->find('all'));
}
}
?>
這是我的看法index.ctp
<?php
$this->PhpExcel->createWorksheet();
// define table cells
$table = array(
array('label' => __('Nombre'), 'filter' => true),
array('label' => __('Apellido'), 'filter' => true),
array('label' => __('Edad individuo')),
array('label' => __('Domicilio'), 'width' => 50, 'wrap' => true),
array('label' => __('Fecha'))
);
// add heading with different font and bold text
$this->PhpExcel->addTableHeader($table, array('name' => 'Cambria', 'bold' => true));
// add data
foreach ($documentos as $documento) {
$this->PhpExcel->addTableRow(array(
$documento['Documento']['nombre'],
$documento['Documento']['apellido'],
$documento['Documento']['edad'],
$documento['Documento']['domicilio'],
$documento['Documento']['fecha']
));
}
// close table and output
$this->PhpExcel->addTableFooter()
->output();
?>
必須包含完整的錯誤,包括行號和文件名的錯誤報告。 –
通常語法錯誤很容易修復... – skywalker