在php中运行脚本

时间:2016-08-23 20:10:49

标签: php python web

我通过我的php运行python脚本。它在控制台上工作正常但在浏览器上运行时返回null。我甚至尝试将输出写入文件,但它不会返回任何内容。 php代码是:

<?php

$y = "python Code.py";

$output = shell_exec($y);

if($output!=null){
echo $output;
}
else {
echo "No output";
}




$myfile = fopen("test.txt", "w") or die("Unable to open file!");

fwrite($myfile, $output);

fclose($myfile);


?>

1 个答案:

答案 0 :(得分:0)

SELECT
    li.SAMLData_Organization,
    li.SessionId,
    m1.TimeCreated as RequestRecieved,
    m2.TimeCreated as ResponseSent
FROM
    ens.messageheader h1
    INNER JOIN HS_Message.XMLMessage m1
    ON h1.MessageBodyId = m1.id
    and m1.name = 'XDSb_RetrieveRequest'
    LEFT JOIN HS_Message.XMLMessage m2
    ON h1.MessageBodyId = m2.id
    and m2.name = 'XDSb_RetrieveResponse'
ORDER BY
    h1.SessionId DESC