2017-06-21 68 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

相关问题