存储错误消息是一种好的做法SESSION吗?例如,重定向后.通过网址传入不是我的解决方案......我想知道它是否是一个很好的解决方案...因为..
一个concurent会提交用户原因问题吗?(很长一段时间的帖子,而ajax内容是从另一个标签获得的)可能搞乱会话!或者这是不可能发生的?
如果用户发出请求并且由于某种原因导致显示页面失败,则该消息可能会显示在不相关的页面上!
所以?任何替代??
例如,使用POST /重定向/获取模式时
此代码需要刷新或单击页面才能进入索引页面,然后在会话过期后更新数据库.
如何在会话过期后自动更新数据库,以便用户激活为0而不刷新或点击页面?
$idletime = 3600; //after 1hr the user gets logged out
if (time() - $_SESSION['timestamp'] >= $idletime){
$online = "UPDATE users SET active = 0 WHERE username = '".$_SESSION['username']."'";
mysqli_query($con, $online);
session_destroy();
header("Location:index.php");
} else {
$_SESSION['timestamp'] = time();
}
Run Code Online (Sandbox Code Playgroud) 我有一个java程序的问题,我正在使用sobel运算符进行边缘检测,但是当我尝试使用该函数时,控制台说:
线程"AWT-EventQueue-0"中的异常java.lang.ArrayIndexOutOfBoundsException:262144 at the Obrasek.jButtonSobelActionPerformed的sun.awt.image.ByteInterleavedRaster.getPixels(ByteInterleavedRaster.java:1015)(Obrazek.java:566)
而代码是:
FileInputStream inFile = null;
try {
long beginTime = (new java.util.Date()).getTime();
int i, j;
double Gx[][], Gy[][], G[][];
inFile = new FileInputStream("D://lenacsmall.bmp");
BufferedImage bi = ImageIO.read(inFile);
int width = bi.getWidth();
int height = bi.getHeight();
int[] pixels = new int[width * height];
int[][] output = new int[width][height];
int[] raster = bi.getRaster().getPixels(0,0,width,height,pixels);
int counter = 0;
for(i = 0 ; i < width ; i++ )
{
for(j = 0 ; j < height ; j++ …Run Code Online (Sandbox Code Playgroud)#include<stdio.h>
void ascii()
{
//code goes here
}
int main()
{
int b;
char a;
b=ascii(a);
printf("%d",b);//Expecting the ASCII Value of a to printed.
return 0;
}
Run Code Online (Sandbox Code Playgroud)
期望printf语句给出a的ASCII值.
提前致谢.