嗨,我正在尝试在我的网站上使用tokbox视频聊天API集成。
我做了什么:
我从tokbox php下载了他们的项目。使用composer,我安装了所需的存储库文件并创建了供应商文件夹。根据他们的指示,我在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。
run-demo文件
#!/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我该怎么解决这个问题呢?
发布于 2017-06-21 16:53:55
你使用run-demo脚本了吗?
run-demo文件在端口8080上启动PHP开发服务器(需要PHP 5.4)。使用run-demo脚本启动服务器:$ ./run-demo。您可以参考此链接- https://github.com/opentok/learning-opentok-php/blob/master/README.md
发布于 2017-06-21 17:49:16
现在,我根据他们的指示在
文件中添加了api-key和secret-key,并使用命令编译了run-demo批处理文件。
看起来您已经编辑了用于在linux/mac上运行的run-demo shell脚本,但您正在运行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.phphttps://stackoverflow.com/questions/44670299
复制相似问题