douyi1963 2014-04-29 23:09 采纳率: 0%
浏览 39
已采纳

作曲家,没有找到课程

I installed composer in my CodeIgniter project, downloaded 2 packages: Aura/Sql and Aura/SqlQuery

this is my code from index.php file

require_once ROOTPATH . 'vendor/autoload.php';

use Aura\Sql\ExtendedPdo;
$db = new ExtendedPdo('mysql:host=127.0.0.1;dbname=mydb', 'root', '', array(), array());
var_dump($db->fetchAll('SELECT * FROM sh_users'));

use Aura\Sql_Query\QueryFactory;
$query_factory = new QueryFactory('mysql');

require_once BASEPATH . 'core/CodeIgniter.php';

both fragments are copied from documentation

var_dump gives perfect result, but QueryFactory gives me error

Fatal error: Class 'Aura\Sql_Query\QueryFactory' not found in F:\XAMPP\htdocs\codeigniter\public\admin\index.php on line 83

and i have no idea why. all vendors are downloaded and all php files are there, but it seems autoload doesnt load it. why?

  • 写回答

1条回答 默认 最新

  • douminfu8033 2014-04-29 23:20
    关注

    Take a look at the file structure on disk; you may actually want to be including Aura\SqlQuery\QueryFactory, instead of something under the Sql_Query namespace. It may be something as simple as that. I've encountered issues when I've forgotten to rename the class in a PSR-0 compliant path such that it matches the file name, so if in fact the contents on the disk are in:

    Aura\SqlQuery\QueryFactory but your use statement is Aura\Sql_Query\QueryFactory, you'll run into a problem.

    As mentioned below in the comments, it appears that the Aura devs have two branches, the master branch on the Githup project auraphp/Aura.Sql_Query still has the directory structure as Sql_Query where as the default package, served by packagist, serves the dev-rename branch which replaces Sql_Query with SqlQuery.

    Hope that helps!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?