2014-06-17 4 views
9

जब मैं APPPATH.'libraries का उपयोग/गूगल/Client.php ', सभी फाइलों को जो require_once में शामिल किए गए हैं, उप फ़ाइल यानी (प्रमाणीकरण/AssertionCredentials.php)CodeIgniter में Google API php क्लाइंट लाइब्रेरी लोड करने में असमर्थ

A PHP Error was encountered 

Severity: Warning 

Message: require_once(Google/Auth/AssertionCredentials.php): failed to open stream: No such file or directory 

Filename: Google/Client.php 

Line Number: 18 
+0

आप सभी Google API फ़ाइलों require_once (APPPATH.'libraries में आधार पथ जोड़ने के लिए/'Google/Auth/AssertionCredentials.php'); लाइन 18 –

+0

की तरह यह बहुत लंबा काम होगा, क्योंकि ** google-api-php-client ** लाइब्रेरी की सभी फाइलें एक दूसरे के साथ जुड़ती हैं। – Rohit

+0

क्या आप सिर्फ एक खोज और प्रतिस्थापन नहीं कर सकते? "Requ_once" Google/"with" require_once APPPATH को बदलें। "पुस्तकालय/Google /" – Craig

उत्तर

2

आप पुस्तकालयों पथ को बदल सकते हैं, गूगल ग्राहक की आवश्यकता होती है, फिर वापस सीआई डिफ़ॉल्ट पथ के लिए स्विच ..

// change directory to libraries path 
    chdir(APPPATH.'libraries'); 

    // include API 
    require_once('Google/Client.php'); 

    // do some stuff here with the Google API 

    // switch back to CI default path 
    chdir(FCPATH); 
15

कॉपी "गूगल" फ़ोल्डर THIRD_PARTY करने के लिए।

आवेदन/पुस्तकालय google.php

<?php 
if (!defined('BASEPATH')) exit('No direct script access allowed'); 
set_include_path(APPPATH . 'third_party/' . PATH_SEPARATOR . get_include_path()); 
require_once APPPATH . 'third_party/Google/Client.php'; 

class Google extends Google_Client { 
    function __construct($params = array()) { 
     parent::__construct(); 
    } 
} 

कहा जाता है के तहत नई फ़ाइल बनाएं तो उपयोग करने के लिए:

$this->load->library('google'); 
echo $this->google->getLibraryVersion(); 
+0

मुझे जोड़ने की भी आवश्यकता है: requ_once APPPATH। 'THIRD_PARTY/गूगल/config.php'; –

+0

यह आवश्यक_ऑन ऐपपैथ होना चाहिए। 'THIRD_PARTY/गूगल/autoload.php'; –

संबंधित मुद्दे