2017-06-21 36 views
1

您好我正在嘗試在我的網站上使用tokbox視頻聊天API集成。您必須在運行演示文件中定義TOKBOX_API_KEY和TOKBOX_SECRET

我做了什麼:

我從tokbox php下載他們的項目。使用作曲家我安裝必需的存儲庫文件並創建供應商文件夾。現在根據他們的說明,我在run-demo文件中添加api-key和secret-key,並使用cmd編譯run-demo批處理文件。當我訪問他們的服務器鏈接http://localhost:8080/session它的節目You must define an TOKBOX_API_KEY and TOKBOX_SECRET in the run-demo file

運行演示文件

#!/bin/sh 

    if [ -z "$TOKBOX_API_KEY" ] || [ -z "$TOKBOX_SECRET" ] 
    then 
    export TOKBOX_API_KEY=<MY_API_KEY> 
    export TOKBOX_SECRET=<MY_API_SECRET> 
    fi 

    if [ -d "storage" ] 
    then 
    rm -rf storage/ 
    fi 

    php -S 0.0.0.0:8080 -t web web/index.php 

:: Why? because windows can't do an OR within the conditional 
    IF NOT DEFINED TOKBOX_API_KEY GOTO defkeysecret 
    IF NOT DEFINED TOKBOX_SECRET GOTO defkeysecret 
    GOTO skipdef 

    :defkeysecret 

    SET TOKBOX_API_KEY= 
    SET TOKBOX_SECRET= 

    :skipdef 

    RD /q /s storage 

    php.exe -S localhost:8080 -t web web/index.php 

我怎麼能解決這個問題?

回答

0

您是否使用run-demo腳本?

運行演示文件在端口8080上啓動PHP CLI開發服務器(需要PHP> = 5.4)。使用run-demo腳本啓動服務器:$ ./run-demo。 您可以參考以下鏈接以供參考 - https://github.com/opentok/learning-opentok-php/blob/master/README.md

+0

是的,我做到了。當我打開該網址時,它顯示出錯。\ – Vivek

+1

我添加了api-key和密鑰......但是它說「你必須在運行演示文件中定義一個TOKBOX_API_KEY和TOKBOX_SECRET' – Vivek

0

現在根據他們的指示我在運行演示文件中加入API密鑰和祕密密鑰,並使用CMD編譯運行演示批處理文件。

看起來你已經editted的run-demo shell腳本在Linux/Mac上運行,但你所運行的Windows批處理文件run-demo.bat。您需要的API密鑰和密碼添加到該文件:https://github.com/opentok/learning-opentok-php/blob/master/run-demo.bat

run-demo.bat

:: Why? because windows can't do an OR within the conditional 
IF NOT DEFINED TOKBOX_API_KEY GOTO defkeysecret 
IF NOT DEFINED TOKBOX_SECRET GOTO defkeysecret 
GOTO skipdef 

:defkeysecret 

SET TOKBOX_API_KEY=<YOUR_API_KEY_HERE> 
SET TOKBOX_SECRET=<YOUR_SECRET_HERE> 

:skipdef 

RD /q /s storage 

php.exe -S localhost:8080 -t web web/index.php 
+1

我做了同樣的錯誤。 – Vivek

相關問題