我想從我的PHP頁面調用python腳本,但沒有輸出正在傳遞。代碼中是否有錯誤?從PHP調用Python腳本
<?php
include('main.php');
$lat = $_POST['lt'];
$lon = $_POST['ln'];
$uid = $_POST['id'];
$rad = $_POST['rd'];
$outs = 'python recommend.py ' . $uid . ' ' . $lat . ' ' . $lon . ' ' . $rad;
$output = shell_exec($outs);
echo $output;
?>
雖然我試圖使用虛擬變量獲取輸出,但它正在顯示。
<?php
$lat = $_POST['lt'];
$lon = $_POST['ln'];
$uid = $_POST['id'];
$rad = $_POST['rd'];
echo "11,28.720663,77.106192,1.18764869157,50.2058551405~12,28.705344,77.147270,2.854 76982119,2.42050298022~14,28.697590,77.143108,2.63211107261,13.1314821232~64,28. 683058,77.079048,2.10283926574,28.9526789043~66,28.670294,77.126684,2.8317092358 ,5.80484607006~67,28.677712,77.092713,1.95077211146,28.4871314757~68,28.665512,7 7.093081,2.76955528898,21.8407451837~71,28.674069,77.124547,2.53467055409,24.755 4907651~"
?>
通過追加'error_reporting(E_ALL);添加錯誤報告給您的php代碼; ini_set('display_errors','1');'在你的php腳本的頂部,它返回什麼? –