2016-08-12 47 views
0

我打算將google +登錄到我的網站,現在我已經到了必須在服務器端設置代碼的地步。谷歌有如何安裝他們的php庫的網頁:https://developers.google.com/api-client-library/php/start/installation。他們建議使用php.ini來包含他的圖書館,但我的網絡託管人不允許我編輯php.ini。包括google + api php客戶端庫沒有php.ini文件

我應該使用這個庫來驗證用戶,登錄用戶,註銷用戶等等。據我所理解。

我該如何在不編輯php.ini的情況下包含所有necesarry依賴關係?單獨使用include或require包含文件對我來說不起作用。

謝謝。

回答

0

link在你的問題頁腳它指出:

Alternatively, you can set the same ini directive dynamically in your code.

set_include_path(get_include_path() . PATH_SEPARATOR . '/path/to/google-api-php-client/src');

你可以按照這個步驟,而不是修改php.ini

+0

感謝您answear但現在當我嘗試使用庫我得到一個不同的錯誤。我應該使用這個代碼$ client = new Google_Client();來自[link](https://developers.google.com/api-client-library/php/start/get_started),但php返回:致命錯誤:未捕獲錯誤:在(htmladress)中找不到類'Google_Client'。 – Elias

+0

@pillikasnazsaxc你可能想嘗試把你傳遞給'set_include_path()'的東西放到'file_exists()'中,並確保這個目錄絕對正確。如果這是可讀的,你可能不得不用另一個問題來解決這個問題。 –

+0

我現在開始工作了,不得不安裝和使用作曲家。 – Elias