我有一个 html 按钮:
<a class="btn btn-sm btn-danger"><i class="ace-icon fa fa-reply"></i>Reset CM</a>
和一个 Angular 变量:“{{product.name}}”
我喜欢用这个按钮运行这个命令:
./cm-reset2.sh -r 172.31.31.10 -k hk15#inhp -m {{product.name}}
知道怎么做吗?我无法将文件从 html 移动到 php。
谢谢
最佳答案
你可以定义一个路由,比如你调用的“/run_command”(可能通过ajax,post/get取决于你是否期望一些响应数据),并且从你的php处理程序中你可以执行shell_exec并运行所需的脚本。
关于php - 从 html 按钮运行脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31728403/