Codeigniter:用户定义的辅助函数不加载

编程入门 行业动态 更新时间:2024-10-28 06:21:34
本文介绍了Codeigniter:用户定义的辅助函数不加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我做了一个自定义助手扩展系统string_helper.php。

I made a custom helper extending the system string_helper.php.

我把它放在我的 / application / helpers 目录,根据需要调用 MY_string_helper.php 单元测试其函数。

I placed it in my /application/helpers directory, called it MY_string_helper.php as required, unit-tested its functions.

尝试从模型调用其中一个函数,它不工作。

Now, when I try to call one of its functions from a model, it does not work.

默认字符串帮助中的函数,而不是工作。

The functions in the default string helper work, instead. It looks like my extension is not loaded for some reasons.

非常感谢和节日快乐。

编辑:甚至更有趣。我在 system / helpers 目录中将文件保存为 categories_helper.php ,当我尝试将其加载到模型我得到以下响应:*无法加载请求的文件:helpers / categories_helper.php *

even funnier. I saved the file as categories_helper.php in the system/helpers directory, and when I try to load it within a model i got the following response: *Unable to load the requested file: helpers/categories_helper.php*

推荐答案

问题。我来自windows操作系统开发我的codeigniter项目,然后转移到Ubuntu,但不知何故,它仍然没有加载我的助手。

I had the same problem. I came from windows OS development of my codeigniter project, then shifted to Ubuntu, but somehow it still didn't load my helpers.

我发现,改变命名约定小写解决了这个问题。不要遵循在文档中写入的内容,其中给出了要插入的前缀,特别是如果大写。使用小写。

I found that changing the naming convention to lowercase solves the problem. Don't follow what's written in the doc where you are given a prefix to insert, especially if it's in uppercase. Make use of lowercase.

更多推荐

Codeigniter:用户定义的辅助函数不加载

本文发布于:2023-10-25 03:09:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1525746.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   加载   定义   用户   Codeigniter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!