如何使用Codeigniter 3在视图中更改扩展名? [英] How to change the extension in view using codeigniter 3?

查看:76
本文介绍了如何使用Codeigniter 3在视图中更改扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题,我已经在本地设置了Codeigniter 3,并使用了第三方(MX东西),现在我已经调整了文件路径,我想更改正在获取控制器的文件扩展名。

Here's my problem I setup Codeigniter 3 in my local and use an thirdparty (MX thing) now that I have adjusted the file path, I wanted to change the file extension that is being fetch the controller.

$this->load->view('welcome_message');






我从以下位置更改视图文件:


I change the file in views from:

welcome_message.php

对此

welcome_message.html






现在我收到此错误


Now I get this error

An Error Was Encountered
Unable to load the requested file: welcome_message.php






,但我想使用.html扩展名,因为我将使用的文件夹路径仅包含html / js / css(模板文件夹)文件(我将php文件分隔为模板文件夹)。


but I wanted to use the .html extension becuase the folder path that I will be using will only contain html/js/css (template folder) files only (i will separate the php files to template folder). How can this possibly happen?

非常感谢任何帮助,谢谢大家!

Any help is greatly appreciated, Thanks guys!

推荐答案

您无需将扩展名更改为html,您可以在php文件中使用html,而无需打开php标签。

You don't need to change extension to html, you can use html in a php file, just don't open php tag.

编辑:

如果确实需要更改分机号,只需执行以下操作:

If you really have to change the ext, just do :

$this->load->view('welcome_message.html'); 

这篇关于如何使用Codeigniter 3在视图中更改扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆