[英]Zend Framework 2 load class PHPGangsta_GoogleAuthenticator
我正在尝试在ZF2中加载一个带有下划线的类。
这是我要使用的项目: https : //github.com/PHPGangsta/GoogleAuthenticator
文件夹路径如下所示:
/module
/Application
/Service
/MyService.php
/vendor/
/PHPGangsta
/GoogleAuthenticator.php
GoogleAuthenticator.php
有一个名为PHPGangsta_GoogleAuthenticator
的类,我想在MyService.php
使用它,而require
任何文件。
另外,我无法更改PHPGangsta
内部的文件,因为该项目在git下进行了子PHPGangsta
。
您可以帮助配置zf2类自动加载吗?
假设您使用Composer(推荐的方法)安装了ZF2,请编辑composer.json
以将phpgangsta/googleauthenticator
添加到require部分。 然后运行composer install
。 而已。 然后,您应该能够在应用程序中使用该库-无需执行任何其他自动加载配置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.