Class Firebase\JWT\JWT not found

前端 未结 5 1335
旧时难觅i
旧时难觅i 2020-12-20 14:57

I want to use pure firebase/php-jwt library in my code. Firstly, I go to /var/www/html/ and like the official library page is suggesting, I do this



        
5条回答
  •  渐次进展
    2020-12-20 15:06

    As per the documentation, you need to include the autoloader.

    E.g., in your php file:

    require __DIR__ . '/vendor/autoload.php';
    

    But... typically your vendor folder would be at the same level than your html folder (the one where you are serving content).

    E.g.:

    - Project root
    --- vendor
    --- html
    ----- index.php
    

    Then in your index.php you'd do:

     require __DIR__ . '../vendor/autoload.php';
    

    It is nice that you trying to use composer and modules, but if I were you I'd try to read on a bit about php's autoloading features, so you understand what's going on, and how you can profit from them.

提交回复
热议问题