codeigniter包括不工作? [英] Codeigniter include not working?

查看:124
本文介绍了codeigniter包括不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种感觉,有这个一个非常明显的解决方案,但我只是没有看到它。我在建设有codeigniter网站。

在我的意见我目录下有两个文件夹:模板&安培; AUTH

我想包括来自模板目录中的头到在 AUTH 目录下的PHP文件。

我与包括包括它在顶部,一如既往'../模板/ header.php文件;

但我得到的错误:


  

消息:包括(../模板/ header.php文件):未能打开流:没有这样的文件或目录


  
  

文件名:AUTH / login.php中



解决方案

要包括 codeIgniter 的任何文件,你应该这样做:

  $这个 - >负载>查看('模板/头');

您可以阅读更多关于包括文件 codeIgniter 这里:

<一个href=\"http://stackoverflow.com/questions/8228141/how-to-include-a-file-inside-a-model-in-$c$cigniter\">how包括在codeigniter一个模型中的文件?

I have a feeling there is a really obvious solution to this but I'm just not seeing it. I'm building a website with codeigniter.

In my views directory I have two folders: template & auth.

I'm trying to include the header from the template directory into a php file in the auth directory.

I'm including it at the top, as always with include '../template/header.php;'

But I'm getting the error:

Message: include(../template/header.php): failed to open stream: No such file or directory

Filename: auth/login.php

解决方案

To include any file in CodeIgniter you should do this :

$this->load->view('template/header');

You can read more about including file in CodeIgniter here :

how to include a file inside a model in codeigniter?

这篇关于codeigniter包括不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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