getthem 发表于 2012-5-4 16:44:00

新手请教,为什么出现Call to undefined function link_tag()错误?

本帖最后由 getthem 于 2012-5-9 14:24 编辑

别人用CI做的网站,在进入后台登录时出现Call to undefined function link_tag()错误,在网上查了很多资料,可能是helper的问题,但是查看了一下,helpers目录是tools_helper.php, 在登录的控制器文件loginc.php中写的是:
parent::__construct();
$this->load->helper('tools');
$this->load->model('groupuserm');
似乎没有写漏或写错,为什么还会出现这样的错误呢?

yuzhigang5460 发表于 2012-5-4 16:58:50

$this->load->helper('html');

getthem 发表于 2012-5-4 20:52:37

yuzhigang5460 发表于 2012-5-4 16:58 static/image/common/back.gif


可否解释一下为什么括号中是html而不是tools?

jeongee 发表于 2012-5-4 22:01:09

getthem 发表于 2012-5-4 20:52 static/image/common/back.gif
可否解释一下为什么括号中是html而不是tools?

因为link_tag函数是ci自带的html_helper里的函数,2楼的意思是活,你还需要加载html helper,而不是把你代码里的tools改成html,明白了吗?
link_tag相关
http://codeigniter.org.cn/user_guide/helpers/html_helper.html#link_tag

getthem 发表于 2012-5-4 22:14:50

jeongee 发表于 2012-5-4 22:01 static/image/common/back.gif
因为link_tag函数是ci自带的html_helper里的函数,2楼的意思是活,你还需要加载html helper,而不是把你 ...

但是在这个网站tools中重新定义了一个link_tag()

getthem 发表于 2012-5-7 10:14:10

jeongee 发表于 2012-5-4 22:01 static/image/common/back.gif
因为link_tag函数是ci自带的html_helper里的函数,2楼的意思是活,你还需要加载html helper,而不是把你 ...

已试过,楼上的提供的方法不行,问题依然存在

Hex 发表于 2012-5-7 12:01:09

getthem 发表于 2012-5-7 10:14 static/image/common/back.gif
已试过,楼上的提供的方法不行,问题依然存在

已有的 helper 函数不要随意重写,请使用其他函数名。

getthem 发表于 2012-5-7 13:47:51

Hex 发表于 2012-5-7 12:01 static/image/common/back.gif
已有的 helper 函数不要随意重写,请使用其他函数名。

换为其它函数名仍有此有问题,是否与php版本有关?

Hex 发表于 2012-5-7 16:10:55

getthem 发表于 2012-5-7 13:47 static/image/common/back.gif
换为其它函数名仍有此有问题,是否与php版本有关?

把你代码都打包发上来看看

getthem 发表于 2012-5-7 16:59:59

Hex 发表于 2012-5-7 16:10 static/image/common/back.gif
把你代码都打包发上来看看

整个后台代码打包的话有15M,分卷也无法上传,我先将controllers和helpers打包上来







页: [1] 2
查看完整版本: 新手请教,为什么出现Call to undefined function link_tag()错误?