作者sdtty (低調低調)
看板PHP
標題[請益] 點選圖片無法啟動php程式
時間Mon Jan 23 23:29:24 2012
HTML code如下,
xxxxxxx.php目的在於讓圖片點擊後隨機load另一張圖
此段code的目的是,當點擊圖片後會重新refresh網址,
並且會啟動php,
<a href="http://我的網址">
<img src="http://我的網址/xxxxxx.php">
</a>
=========
xxxxxx.Php code 如下
<?php
$temp=(mt_rand(1,3));
switch ($temp)
{
Case "1":
$ad1="XXX.jpg";
header("Location: ".$ad1);
exit;
break;
Case "2":
$ad2="XXXX.jpg";
header("Location: ".$ad2);
exit;
break;
Case "3":
$ad3="xxxxxx.jpg";
header("Location: ".$ad3);
exit;
break;
}
?>
點擊圖片重新reload網址後 圖片並無"隨機" 還是延續第一次開啟網頁的圖片~
但是如果將瀏覽器重新refresh 圖片卻有隨機...
實在不知道是哪邊出了問題 請各位大大指點 拜託拜託
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.123.71.67
1F:推 bibo9901:感覺是瀏覽器cache的問題 01/23 23:31
2F:→ poi987poi987:xxxx.php?xxx 01/23 23:44
3F:→ averywu: src="http://我的網址/xxxxxx.php" 可以這樣用嗎 01/25 15:30
4F:推 LaPass:可以啊.... 至少ie firefox沒問題 01/25 22:37
5F:推 lolikung:xxx 有中文嘛 01/27 21:42
6F:推 cochiachang:聽起來會不會點擊時ajax換圖動作失效? 02/05 08:29