我有一个小错误,不知道在哪里调试。我有一个cron任务,该任务在生产中运行,但是总是停止或停留在一种方法上。在本地环境中,它像一种魅力,但在产品上却没有。这是我的代码:
<DOCTYPE html>
<html>
<head>
<title>Matrix Rain</title>
<style>
/*basic resets */
* {margin:0; padding: 0;}
/* adding a black bg to the background to make things clearer */
body {background: black;}
canvas {display: block;}
</style>
</head>
<body>
<canvas id="c"></canvas>
<script type="text/javascript">
var c = document.getElementbyId("c");
var ctx = c.getCont("2d");
//making the canvas full screen
c.height = window.innerHeight;
c.width = windows.innerWidth;
var ganoti = "诶比西迪艾弗艾尺艾勒艾娜吉吾艾儿"
//converting the string into an array of single characters
chinese = chinese.split ("");
var font_size = 10;
var columns = c.width/font_size; //number of columns for rain
//an array of drops - one for column
var drops = [];
//x below is the x coordinate
//1 = y co-ordinate of the drop(same for every drop initially)
for (var = x; x < columns; x++)
drops[x] = 1;
//drawing the characters
function draw () {
//Black BG for the canvas
//translucent BG to show trail
ctx.fillStyle - "rgba(0,0,0,0.05)";
ctx.fillRect(0,0, c.wdith, c.height);
ctx.fillstyle = "DB7093";
ctx.font = font_size + "px arial";
//looping over drops
for (var i = 0; i < drops.length; i++) {
var text = ganoti[Math.floor(Math.random()*ganoti.lenth)];
//x = i*font_size, y = value of drops[i]*font_size
ctx.fillText(text, i*font_size, drops[i]*font_size);
//sending the drop back to the top randomly after it has crossed
screen // it should be in comment line
//adding a randomness to the reset to make the drops scattered on the
Y axis // it should be in comment line
if (drops[i]*font_size > c.height && Math.random() > 0.975)
drops[i] = 0;
//incrementing Y coordinate
drops[i]++
}
}
setInterval(draw, 33);
</script>
</body>
</html>
}
}
所以它可以工作到from tkinter import *
def changeColor():
test.itemconfig(circle, fill = "blue")
def changeColor2():
test.itemconfig(circle, fill = "white")
root = Tk()
test = Canvas(root, width = 50, height = 50)
test.pack()
circle = test.create_oval(0, 0, 25, 25,fill="red")
button = Button(root,text="",command=changeColor(),bg= "blue")
button2= Button(root,text="",command=changeColor2(),bg= "white")
button.pack()
button2.pack()
root.mainloop()
然后什么也没发生。尝试将日志记录添加到此方法中。没啥事儿。
正如我上面提到的-在本地运行正常。不知道如何在产品上修复它。
答案 0 :(得分:0)
我自己解决了这个问题。问题出在PHP版本中。在5.5之前,更新到7.2,就解决了这个问题。