[英]Kohana ErrorException [Fatal Error] : Class 'Model_Winners' not found
class Controller_Home extends Controller {
public function action_index()
{
$model_winners = new Model_Winners;
Kohana throws following exception when I try to create object of model named winners from controller. 当我尝试从控制器创建名为winners的模型对象时,Kohana引发以下异常。
Model winners: 模型优胜者:
class Model_Winners extends Model
{
public function get($offset=0, $limit = 10)
{
The Environment -> Included files lists file APPPATH/classes/model/winners.php 环境->包含的文件列出了文件APPPATH / classes / model / winners.php
I'm aware of the file name conventions and case-sensitive nature. 我知道文件名约定和区分大小写的性质。 Tried the same code in WAMP stack too, but same exception thrown.
在WAMP堆栈中也尝试了相同的代码,但是引发了相同的异常。
Issue solved 问题已解决
I set 'errors' => FALSE
in Kohana init method. 我在Kohana init方法中设置了
'errors' => FALSE
。
This will revert system to show standard PHP errors. 这将还原系统以显示标准的PHP错误。
The error was in fact thrown by an exception on database connection, this error was not shown on the stack trace when the Kohana error handler was handling the errors. 该错误实际上是由数据库连接上的异常引发的,当Kohana错误处理程序正在处理错误时,该错误未显示在堆栈跟踪中。 After resolving the issue, re enabled the error handler by setting 'errors' => TRUE
解决问题后,通过设置'errors'=> TRUE重新启用错误处理程序
If you are using Kohana 3.3 the files need top start with upper case , so the file path would be: 如果您使用Kohana 3.3,则文件必须以大写开头 ,因此文件路径为:
APPPATH/classes/Model/Winners.php
. APPPATH/classes/Model/Winners.php
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.