在哪个文件夹中放置我在Kohana 3.1框架中扩展的类?

[英]In which folder to place the classes that I extend in the Kohana 3.1 framework?


I am new to the kohana php framework. In the modules folder in kohana 3.1, there are many empty files extending the existing classes. Should I write my code in those empty files? If yes, do I have to make any changes in bootstrap? If not, where should I place these files? Should they be in a subfolder inside the Application directory or inside the modules directory? Which all files will I have to copy from the modules to application?

我是kohana php框架的新手。在kohana 3.1的modules文件夹中,有许多空文件扩展了现有的类。我应该在那些空文件中编写我的代码吗?如果是,我是否必须在bootstrap中进行任何更改?如果没有,我应该在哪里放置这些文件?它们应该位于Application目录内的子文件夹中还是位于modules目录中?我需要将哪些文件从模块复制到应用程序?

2 个解决方案

#1


0  

Those empty files you see are aliases created for the class. An example would be the Cookie class, declared as so:

您看到的那些空文件是为该类创建的别名。一个例子是Cookie类,声明如下:

class Cookie extends Kohana_Cookie {}

It's just another way for you to refer to the real class, in this case Kohana_Cookie, without having to type all that out.

这只是另一种方式,你可以引用真正的类,在这种情况下Kohana_Cookie,而不必输入所有这些。

So when you use something like Cookie::salt($name, $value) you're really just using Kohana_Cookie::salt($name, $value).

所以当你使用像Cookie :: salt($ name,$ value)之类的东西时,你真的只是使用Kohana_Cookie :: salt($ name,$ value)。

If you want to extend a class, you can drop the files into your application/classes folder and go from there.

如果要扩展类,可以将文件放到application / classes文件夹中,然后从那里开始。

#2


0  

check out the docs at http://kohanaframework.org/3.1/guide especially: http://kohanaframework.org/3.1/guide/kohana/files

请查看http://kohanaframework.org/3.1/guide上的文档,特别是:http://kohanaframework.org/3.1/guide/kohana/files

you can extend classes in the folder: application/classes/.. or modules//classes/..

你可以扩展文件夹中的类:application / classes / ..或modules // classes / ..


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/04/08/2fcd1a1d92fa02cf5a4e89bf13f83234.html



 
  © 2014-2022 ITdaan.com 联系我们: