CakePHP - 我不能得到App :: uses()来找我的类 [英] CakePHP - I can't get App::uses() to find my class

查看:103
本文介绍了CakePHP - 我不能得到App :: uses()来找我的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些只包含静态实用程序方法的自定义类:

I have some custom classes that just contain static utility methods:

app/Lib/Utility/AppString.php

Cake找不到类。我试过:

Cake can't find the class though. I have tried:

// app/Config/bootstrap.php

App::uses('AppString', 'Utility');
App::uses('AppString', 'Lib/Utility');
App::uses('AppString', 'Lib');

我不知道我应该怎么让Cake去找类。我在我的bootstrap.php这样做,因为类是必不可少的应用程序。

I don't know what I should be putting to get Cake to find the classes. I am doing this in my bootstrap.php because the classes are essential to the app.

推荐答案

使用:

App::uses('AppString', 'Utility');

但是,我的类AppString中有一个语法错误。这会导致混乱的消息,因为PHP将报告一个致命错误,该类无法找到,实际上它只是因为文件中的错误。

However, there was a syntax error in my class AppString. This causes confusing messages, as PHP will report a fatal error that the class could not be found, when in fact it's just because of the error in the file.

这篇关于CakePHP - 我不能得到App :: uses()来找我的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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