使用 .html 页面浏览量而不是 .php?代码点火器
Using .html page views instead of .php? CodeIgniter
在 CodeIgniter 中,我有以 .html 结尾的视图文件和以 .php 结尾的其他视图文件。使用 .html 文件,我似乎仍然可以插入 PHP 代码并且它工作正常。我真的注意到这两种类型之间没有区别。有什么区别?
您可以像下面的代码一样使用 html 文件,唯一的区别是您需要在控制器上包含 .html
$this->load->view('example.html');
// Passing Data
$data['title'] = 'Something';
$this->load->view('example.html', $data);
哪里php
$this->load->view('example');
// Passing Data
$data['title'] = 'Something';
$this->load->view('example', $data);
在 CodeIgniter 中,我有以 .html 结尾的视图文件和以 .php 结尾的其他视图文件。使用 .html 文件,我似乎仍然可以插入 PHP 代码并且它工作正常。我真的注意到这两种类型之间没有区别。有什么区别?
您可以像下面的代码一样使用 html 文件,唯一的区别是您需要在控制器上包含 .html
$this->load->view('example.html');
// Passing Data
$data['title'] = 'Something';
$this->load->view('example.html', $data);
哪里php
$this->load->view('example');
// Passing Data
$data['title'] = 'Something';
$this->load->view('example', $data);