加载视图-Codeigniter错误 [英] Load views - Error with codeigniter
问题描述
我是codigniter的新手,正在做一个菜单,所以我将所有链接都放在同一个主文件中,以防止重复出现。
I'm a newbie with codigniter, I'm doing a menu, so I put all the links not in the same main file for not repeat all time.
我的代码是:
在main.php中
<?=$this->load->view('headers/menu');?>
在menu.php
<span><a href="<?=base_url()?>main/agregar">Agregar</a></span>
<span><a href="<?=base_url()?>main/modificar">Modificar</a></span>
<span><a href="<?=base_url()?>main/eliminar">Eliminar</a></span>
<span><a href="<?=base_url()?>main/buscar">Buscar</a></span>
因此,出现以下错误,我不知道为什么...
any想法???非常感谢
So, the following error appears and I don't know why... any ideas??? Thank you so much
遇到PHP错误
A PHP Error was encountered
严重性:4096
消息:CI_Loader类的对象无法转换为字符串
Message: Object of class CI_Loader could not be converted to string
文件名:views / main.php
Filename: views/main.php
行号:15
回溯:
文件:C:xamppamphtdocs\everisgas\application\views\main.php行:15
功能:_error_handler
File: C:\xampp\htdocs\everisgas\application\views\main.php Line: 15 Function: _error_handler
文件: C:xampp\htdocs\everisgas\application\controllers\main.php行:
9功能:view
File: C:\xampp\htdocs\everisgas\application\controllers\main.php Line: 9 Function: view
文件:C :\xampp\htdocs\everisgas\index.php行:292功能:
require_once
File: C:\xampp\htdocs\everisgas\index.php Line: 292 Function: require_once
推荐答案
这可能与您的框架版本有关。例如在CI 2.6中
This can be about the version of your framework. For example in CI 2.6
<?php echo $this->load->view('headers/menu');?>
可以运行,但在CI 3.0中
works but in CI 3.0
<?php $this->load->view('headers/menu');?>
是用法。
这篇关于加载视图-Codeigniter错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!