php - 使用刀片表单信息在 laravel 中运行 python 命令
问题描述
我正在尝试启动一个 python 脚本,其中一些信息存储在 laravel 5.6 中的表单中
该表格包含以下信息:
{!! Form::open(['action' => ['FormulaController@update', $formula->id], 'method' => 'POST']) !!}
<div class="form-group">
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<td>{{Form::label('tipo', 'Tipo Salida')}}
{{Form::select('tipo', ['int', 'float', 'booleano'], $formula->tipo_salida, ['class' => 'form-control', 'id' => 'tipo'])}}</td>
<td colspan="2">{{Form::label('variables', 'Variables')}}
{{Form::text('variables', $formula->variables, ['class' => 'form-control', 'placeholder' => 'nox,/', 'id' => 'variables'])}}</td>
</tr>
<tr>
<td colspan="3">{{Form::label('formula', 'Fórmula')}}
{{Form::text('formula', $formula->formula, ['class' => 'form-control', 'placeholder' => 'a*1', 'id' => 'formula'])}}</td>
</tr>
<tr>
<td><h6>{{Form::label('Nombreresultado', 'Resultado:')}}</h6></td>
<td>{{Form::label('resultado', $salida_formula)}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<a href="/dahs/formulas/{{$formula->id}}" class="btn btn-primary">Back</a>
<input class="btn btn-primary" value="Evaluate" type="button"/>
{{Form::hidden('_method','PUT')}}
{{Form::submit('Guardar', ['class'=>'btn btn-primary'])}}
{!! Form::close() !!}
这个想法是,使用“评估”按钮,页面从表单的选择和文本中获取信息,并执行如下 python 脚本:
$/usr/bin/python /var/www/cgi-bin/evaluate.py 'nox_mgm3;float;a*1.881;nox,/'
我尝试了几种方法,直接在我的刀片模板、javascript、symfony 进程中使用 php 代码,但仍然发现这很奇怪,代码不好,或者可能不是“laravel 方式”
有没有这样的方法?还是我以这些方式中的某些方法是正确的?
此致
解决方案
推荐阅读
- flutter - 如何在不使用任何插件的情况下添加 2 个色调图标?
- python - Python:NLTK - 正则表达式标记器产生空输出
- javascript - 货币在具有相同语言环境的 iOS 和 android 上的格式不同
- android - 我怎样才能通过只使用一个 xml 标签来做到这一点
- java - 使用 http 客户端发布 tar.gz 文件时出错,但使用 curl 命令可以正常工作
- ssl - 错误“ERR_INVALID_REDIRECT”到表单登录
- pandas - 在 Pandas 中仅删除行中的第一个值
- laravel - 如何同时删除order和order_mapping表数据
- angular - 在 Angular 中动态更改类
- java - JSON-B 的循环引用问题