Dropbox api无法在codeigniter中运行?

时间:2015-04-01 12:09:23

标签: php codeigniter

public function request_dropbox()
{
    $params['key'] = 'gr3kempuvsiqsli';
    $params['secret'] = 'qtdl8lmm9r0rlk1';

    $this->load->library('dropbox', $params); 

    $data = $this->dropbox->get_request_token(base_url());
    $this->session->set_userdata('token_secret', $data['token_secret']);
    redirect($data['redirect']);
}
//This method should not be called directly, it will be called after 
//the user approves your application and dropbox redirects to it
public function access_dropbox()
{
    $params['key'] = 'gr3kempuvsiqsli';
    $params['secret'] = 'qtdl8lmm9r0rlk1';

    $this->load->library('dropbox', $params);
    $oauth = $this->dropbox->get_access_token($this->session->userdata('token_secret'));        
    $this->session->set_userdata('oauth_token', $oauth['oauth_token']);
    $this->session->set_userdata('oauth_token_secret', $oauth['oauth_token_secret']);
    redirect('welcome/test_dropbox');
}
//Once your application is approved you can proceed to load the library
//with the access token data stored in the session. If you see your account
//information printed out then you have successfully authenticated with
//dropbox and can use the library to interact with your account.
public function test_dropbox()
{
    $params['key'] = 'gr3kempuvsiqsli';
    $params['secret'] = 'qtdl8lmm9r0rlk1';
    $params['access'] = array('oauth_token'=>urlencode($this->session->userdata('oauth_token')),
                              'oauth_token_secret'=>urlencode($this->session->userdata('oauth_token_secret')));

    $this->load->library('dropbox', $params);

    $dbobj = $this->dropbox->account();

    print_r($dbobj);

}

块引用 我使用过Dropbox库https://github.com/jimdoescode/CodeIgniter-Dropbox-API-Library 当我调用函数request_dropbox()时,它给出了api中的错误“致命错误:在第478行的C:\ xampp \ htdocs \ reports \ application \ libraries \ Dropbox.php中调用未定义的函数curl_init()” 请帮我看看如何访问Dropbox文件。

1 个答案:

答案 0 :(得分:1)

请更仔细地查看您的错误,结果是您的Xampp环境中未启用curl。

这可以帮助您启用CURL并让您重新开始。

How to enable curl in xampp?