unexpected 'use' (T_USE) when trying to use composer

后端 未结 3 1628
北海茫月
北海茫月 2020-12-03 10:10

So, I am trying to use the coinbase API. I\'m attempting a simple test to see if I can make it work, but I\'m getting various composer errors.

Currently, I am getti

相关标签:
3条回答
  • 2020-12-03 10:50

    I'm using codeigniter when i try to use "use" keyword its throwing error within a method.

    SO i just moved it to above class declaration.

    <?php
      defined('BASEPATH') OR exit('No direct script access allowed');
      use Auth0\SDK\Auth0;
    
      class Home extends CI_Controller {
    
      }
    ?>
    

    Its working fine.

    0 讨论(0)
  • 2020-12-03 10:55

    Errors

    "Currently, I am getting unexpected t 'use' for this code " Or

    parse error: syntax error, unexpected 'use' (T_USE)
    

    Well I found such issue and wish to tell you I was using While loop I mean calling data from the database so actually whenever you see any " T " its mean you are Repeating the same script so I was doing the same and when to put it outside the while loop it worked for me It's my First Post here Jamal shah (From PAKISTAN)

    0 讨论(0)
  • 2020-12-03 10:56

    You cannot use "use" where you are using it.

    The "use" keyword is either in front of a class definition to import other classes/interfaces/traits into it's own namespace, or it is inside the class (but not inside a method) to add traits to the class.

    <?php
    namespace Foo;
    
    use Different\Class; // use can go here
    
    class Bar {
      use TraitCode; // use can go here
    
      public function baz() {
        $this->traitFunction('etc');
        // use CANNOT go here
      }
    }
    
    0 讨论(0)
提交回复
热议问题