Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
241 views
in Technique[技术] by (71.8m points)

php - Session data displaying url of previous picture

I am trying to send data from one php file to another php file with sessions. Using ajax to refresh both scripts at same time on my main page. One php script picks random picture from folder and displays it on main page, now I am trying to add report function that is in separated.

Now in file that is getting random picture I am doing

session_start();
$_SESSION['userName'] = 'Root';
$images[$i];
$_SESSION['picture'] = $images[$i];

and in my report.php I have

session_start();
$picturepath = $_SESSION['picture'];
echo $picturepath;

I am calling them like this in my mainfile.html

function Refresh()
{
$('#picturehere').load('getRandom.php')
$('#report').load('report.php')
};

Now the problem is, every time I execute that function, my report.php stores value from previous picture. But if I do ctrl + f5, the value will be from current picture. Is there any way around this?

Example: First refresh:

picture url: picture1.png
session value: picture1.png

Now calling Refresh function

picture url: picture2.png
session value: picture1.png
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...