douhuang4166 2017-06-12 11:01
浏览 37
已采纳

使用Composer在PHP项目中加载类

I have difficulties to use this project : https://github.com/php-sepa-xml/php-sepa-xml

I set up everything with composer but I don't know how to generate the xml file.

In the doc folder, there is a sample file, I copy / paste the content in a new php file

<?php
use Digitick\Sepa\TransferFile\Factory\TransferFileFacadeFactory;
use Digitick\Sepa\PaymentInformation;

// Code....
?>

when I run the code I have an error:

Fatal error: Uncaught Error: Class 'Digitick\Sepa\TransferFile\Factory\TransferFileFacadeFactory' not found
 in C:\dev\php-sepa-xml\vendor\digitick\sepa-xml\lib\sample.php:5

I tried to move my php file in different folders and also to change the path but I always have the error.

Note: I'm on Windows so the path may be different.

  • 写回答

1条回答 默认 最新

  • doushou1298 2017-06-12 11:06
    关注

    If you set it up using composer, please add autoloader in the top of php file.

    <?php
    require "vendor/autoload.php";
    use Digitick\Sepa\TransferFile\Factory\TransferFileFacadeFactory;
    use Digitick\Sepa\PaymentInformation;
    
    // Code....
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Chrome Manifest扩展引用Ajax-hook库拦截请求失败
  • ¥15 用Ros中的Topic通讯方式控制小乌龟的速度,走矩形;编写订阅器代码
  • ¥15 LLM accuracy检测
  • ¥15 pycharm添加远程解释器报错
  • ¥15 如何让子窗口鼠标滚动独立,不要传递消息给主窗口
  • ¥15 如何能达到用ping0.cc检测成这样?如图
  • ¥15 关于#DMA固件#的问题,请各位专家解答!
  • ¥15 请问华为OD岗位的内部职业发展通道都有哪些,以及各个级别晋升的要求
  • ¥20 微信小程序 canvas 问题
  • ¥15 系统 24h2 专业工作站版,浏览文件夹的图库,视频,图片之类的怎样删除?