您好我已经尝试了一些其他发布修复程序,看看我做错了什么,但仍然没有拉动我的cron作业字符串中传递的变量
php -q public_html/conquest/update_power_server.php method=Password
这是我的Cron Job String,这是它调用的脚本。
$mymethod = $_SERVER['argv'];
$method = $mymethod[1];
$con=mysqli_connect("localhost", $user_name, $password, $database_name);
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
echo $method;
if($method == $scpassword)
{
$result = mysqli_query($con,"SELECT * FROM `$table_name` WHERE energy < 30");
while($row = mysqli_fetch_array($result))
{
$uuid = $row['uuid'];
$newenergy = $row['energy'] + 1;
mysqli_query($con,"UPDATE `$table_name` SET energy = '$newenergy' WHERE uuid = '$uuid'");
}
mysqli_close($con);
exit;
}else{
echo ("Access Denied!!!");
exit;
}
?>
它调用脚本,但无法弄清楚如何让变量通过,所以我可以使用它任何帮助指向我正确的方向或帮助我修复将有帮助谢谢。
答案 0 :(得分:0)
这就是我修复它的方法:
$mymethod = $_SERVER['argv'];
$arrmethod = $mymethod[1];
parse_str($arrmethod);
echo $method;