<?php
|
set_time_limit(120); //暂时设置本脚本执行时间秒
|
header("Content-type: text/html; charset=utf-8");
|
include_once '/Common/Logging.php';
|
|
\Logging\CreateLogging('eventdata.toolcenter.php');
|
\Logging\LogInfo("_POST: " . print_r($_POST, true));
|
|
$eventType = $_POST["eventType"];
|
$pyScriptName = $eventType . ".py";
|
if (!$eventType || !file_exists($pyScriptName)) {
|
echo "error: center server can not found script " . $eventType;
|
return;
|
}
|
|
// 删除不用的参数
|
// unset($_POST["eventType"]);
|
|
$cmd = "python " . $pyScriptName;
|
$argvs = "";
|
foreach ($_POST as $key => $value) {
|
if ($value) {
|
$value = str_replace("\"", "\\\"", $value);
|
$value = str_replace(" ", "", $value);
|
$argvs .= " " . $key . "=[" . trim($value) . "]";
|
}
|
}
|
$cmd .= $argvs;
|
\Logging\LogInfo("cmd: " . $cmd);
|
$ret = exec($cmd);
|
// \Logging\LogInfo("ret: " . $ret);
|
echo $ret;
|