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 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失