2017-04-13 5 views
1

私のCodeIgniterプロジェクトにMollieライブラリ(https://github.com/mollie/mollie-api-php)を追加したいと思います。CodeIgniterの外部ライブラリ(グローバル変数)

私はgithubページの手順を踏襲しています。私は作者を使用していないので、ファイルをダウンロードして、コントローラに 'require ../Molie/API/Autoloader.php'を追加しました。

以下のコードでは、Undefined variable: molliefunction ideal_get())のようなエラーが表示されます。私は間違っているの?

require APPPATH.'/libraries/REST_Controller.php'; 
require "../Mollie/API/Autoloader.php"; 
class Pay extends REST_Controller { 

    public $mollie; 

    function __construct() 
    { 
     parent::__construct(); 
     $this->load->model('group_model'); 
     $this->load->model('participant_model'); 

     $mollie = new Mollie_API_Client; 
     $mollie->setApiKey("test_jcQEp2Hkb6pBaC38GsfSPHwkcNVBGU"); 
    } 

    function ideal_get(){ 
     $issuers = $mollie->issuers->all(); 

     $this->response($issuers, 200); 
    } 
} 
+0

こんにちは@NVOで宣言されたあなたのモリー変数にアクセスしないでくださいテストキーだけであっても、APIキーを自分のために保管することをお勧めします。私はあなたのための新しいテストキーを生成したので、あなたのコードであなたのキーを更新することを確認してください。新しいキーは[ダッシュボードで](https://www.mollie.com/dashboard/settings/profiles/)にあります。ご不明な点がございましたら、[email protected]までメールしてください。乾杯、Daan - Mollie B.V. – Daan

+0

愚かな私!あなたの意識に感謝します! – NVO

答えて

3

あなたがそののほかに、あなたのサードパーティフォルダ でモリーのLIBを置く必要があります - 以下を試してみてください - あなたは、コントローラ正しく

require APPPATH.'/libraries/REST_Controller.php'; 
require "../Mollie/API/Autoloader.php"; 
class Pay extends REST_Controller { 

    public $mollie; 

    function __construct() 
    { 
     parent::__construct(); 
     $this->load->model('group_model'); 
     $this->load->model('participant_model'); 

     $this->mollie = new Mollie_API_Client; 
     $this->mollie->setApiKey("test_jcQEp2Hkb6pBaC38GsfSPHwkcNVBGU"); 
    } 

    function ideal_get(){ 
     $issuers = $this->mollie->issuers->all(); 

     $this->response($issuers, 200); 
    } 
} 
+0

愚かな私、私は知っていた、私はそれを知っていた!ありがとう! – NVO

関連する問題