php - 如何在 PHP 和 CodeIgniter 中的页眉和页脚之间显示 html 文件
问题描述
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
//error_reporting(0);
$this->load->view('layouts/topmenu.php', $metaData);
//echo $emailid;
//exit;
?>
//I would like to display an HTML file here
<a href=""></a>
<?php $this->load->view('layouts/bottom'); ?>
<?php $this->load->view('layouts/footer'); ?>
我想显示一个页眉和页脚页面,它们之间有一个 html 文件,该文件位于 .html 文件中。
如何在 PHP 代码中显示 .html 文件?
解决方案
Codeigniter 的好处之一是这很容易做到,并且有多种方法可以做到
由于看起来问题在于您需要调用的视图是 html 文件而不是 php 文件,因此您只需将 html 文件放在您的views
目录中并加载它,指定文件扩展名:
$this->load->view('layouts/file.html');
这就是它的全部
推荐阅读
- windows - opencv_traincascade 没有输出到控制台,大约 2 分钟后“完成”,并且没有输出任何文件
- mobile - 适用于桌面和移动浏览器的 html5boilerplate 站点
- python - 带有或语句的python表达式
- java - 一位消费者在两个不同的集群上从两个不同的主题消费
- google-apps-script - getActiveRange() 和 getSelection() 有什么区别?
- c - 在 NVIDIA Jetson TX2 上运行 GStreamer 的上限协商问题
- reactjs - 手机上的 react-google-maps 街景
- javascript - 加载元素时运行函数
- linux - 从脚本的输出中提取一个值并存储在一个变量 linux 中?
- python - 熊猫 read_sql 的 Python 编码问题