php - 从 html 按钮运行脚本

标签 php html angularjs linux

我有一个 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/

相关文章:

javascript - 将函数分配给 jQuery 中的单个字母

javascript - 在 Bootstrap 中使用 vertical scrollspy 时如何获得全宽图像?

php - _自动加载问题

php - 无法在 PHP 中将字符串转换为整数

php - sql query cannot read from another table (mysql 表关系)

jquery - 如何将CSS样式应用于另一个类中的类?

javascript - AngularJS 中的 HTTPS 'GET'

javascript - 为需要 ng-model 的 Angular Directive(指令)编写单元测试

angularjs - 整合 Karma 和 webstorm

php 将所有链接转换为绝对 url