dsh77114 2010-07-30 21:20
浏览 34
已采纳

在Kohana中使用自定义类3

Hey, I'm creating a Call of duty 4 Server Watcher in Kohana 3, and I had created the basic classes for it before:

  1. A static Socket class (for handling basic network commands)
  2. A Cod4Socket class, (which uses the previously mentioned Socket class) that provides wrapper functions for basic commands.

What I want is to be able to use said classes inside the controllers for the website.

Where am I supposed to put the class files, where should I "include" them, and how do I use them?

Edit: I'm using Kohana 3.

  • 写回答

3条回答 默认 最新

  • duanlei8119 2010-08-06 10:41
    关注

    Where am I supposed to put the class files?

    Add your class files into the application/classes/ directory with lowercase filenames.

    • Socket should go into application/classes/socket.php
    • Cod4Socket should go into application/classes/cod4socket.php

    Where should I "include" them, and how do I use them?

    There is no need to manually include them; simply use them as if they were already included. The Kohana autoloader will find the classes if they're in the right files.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?