2013-03-21 151 views
0

我试图延长Kohana_Database_PDO位于 的Kohana \模块\数据库\类\ Kohana的\数据库ErrorException [致命错误]:类“Database_PDO”未找到

要做到这一点,我在PDO制作的文档。在 Kohana的\应用程序\类php文件\数据库

我使用的代码是

<?php defined('SYSPATH') OR die('No direct script access.'); 
/** 
* PDO database connection. 
* 
* @package Application 
* @category Drivers 
*/ 
class Application_Database_PDO extends Kohana_Database_PDO {} // End Database_PDO 

我得到的错误:


ErrorException [致命错误]:类 'Database_PDO' 未找到 MODPATH \数据库\类\ Kohana的\ database.php中[78]

// Set the driver class name 
    $driver = 'Database_'.ucfirst($config['type']); 
    // Create the database connection instance 
    $driver = new $driver($name, $config); <- highlighted line 

    // Store the database instance 
    Database::$instances[$name] = $driver; 
} 
  1. {PHP内部呼叫}»Kohana_Core: :shutdown_handler()

感谢您的帮助:)

+0

你使用什么Kohana版本? – 2013-03-22 07:35:35

回答

2

如果此代码:

<?php defined('SYSPATH') OR die('No direct script access.'); 
/** 
* PDO database connection. 
* 
* @package Application 
* @category Drivers 
*/ 
class Application_Database_PDO extends Kohana_Database_PDO {} // End Database_PDO 

是你PDO.php文件驻留在APPPATH /班/库那也难怪,这是行不通的代码。

你的文件应该是这样的:

<?php defined('SYSPATH') or die('No direct script access.'); 
/** 
* PDO database connection. 
* 
* @package Application 
* @category Drivers 
*/ 
class Database_PDO extends Kohana_Database_PDO {... 

否则,如果你需要它是应用_...那么你必须做你folderstructure这样的:APPPATH/classes/Application/Database/PDO.php默认爆炸类名

的Kohana使用_作为针,并使用每个字符串部分作为目录,除了最后一个是文件名

+0

谢谢。我现在对Kohana有了更好的理解,错误消失了:)。 – C9HDN 2013-03-22 14:27:59

+0

我经历了同样的直到我有我的PDO类运行。 – ITroubs 2013-03-22 16:34:52

相关问题