我试图扩展Kohana_Database_PDO位于kohana kohana 数据库模块 类数据库
为此,我在PDO.php文件中创建了一个文件数据库类kohana 程序
我使用的代码是<?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 [Fatal Error]: Class 'Database_PDO' not foundMODPATHdatabaseclassesKohana 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;
}
- {PHP内部调用}»Kohana_Core::shutdown_handler()
谢谢你的帮助
如果以下代码:
<?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/classes/Database中,那么它不工作就不足为奇了。
你的文件应该是这样的:
<?php defined('SYSPATH') or die('No direct script access.');
/**
* PDO database connection.
*
* @package Application
* @category Drivers
*/
class Database_PDO extends Kohana_Database_PDO {...
否则,如果您需要它是Application_…然后你要做这样的文件夹结构:APPPATH/classes/Application/Database/PDO.php
Kohana默认使用_
作为指针来爆炸Classname,并使用每个字符串部分作为目录,除了最后一个是文件名