在哪個文件夾中放置我在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 联系我们: