php - Issues Running Bash Script with PHP Parameters
问题描述
I am controlling LED's on a RPI 3 B Vi2 using a php script on another machine on a chatbot (DialogFlow). On the PHP script I have a command that calls the script on the RPI from the /var/www/html directory. The bash script is simple, it contains the following:
#!/bin/bash
echo "gpio -1 mode $1 out" | at $3
echo "gpio -1 write $1 $2" | $3
That's it. the command that calls this on the php script is:
echo exec('./script.sh 7 1 $Time', $output, $return);
print_r($return);
The command works if you substitute '$Time' with an actual figure but does not work using parameters (I have tried different types of variables too). Does anybody have any knowledge that could be beneficial to me regarding this matter?
Many thanks.
解决方案
推荐阅读
- google-drive-api - 将云端硬盘数据转移到另一个域
- ios - 如何使用 Alamofire 或 NSUrl swift iOS 将图像并行上传到服务器
- android - 尝试匹配微调器和文本字段的文本内容,但“withText”和“withSpinnerText”正在返回有关组件的数据
- javascript - Kendo ui 将文件附加到 PUT 请求:javascript
- linux - 无法打开流:Laravel 中的权限被拒绝
- excel - Google Drive 文件夹的动态路径
- typescript - 传递要在 Typescript 中应用的参数数组
- oracle - 按钮按下时的顺序 Oracle 表单
- c# - 如何修复“索引(基于零)必须大于或等于零”错误
- c# - 如何将小时分钟秒转换为十进制数