已經(jīng)晚了 - 我可能缺少一些非常簡單的東西,但我現(xiàn)在無法弄清楚。我的功能: function likes(){ global $connection; $stmt = $connection->prepare("INSERT INTO likes (article_id, ip_address) VALUES (?, ?)"); $stmt->bind_param("is", $_GET['id'], $_SERVER['REMOTE_ADDR']); $stmt->execute(); $result = $stmt->get_result(); if($result) { header("location:javascript://history.go(-1)"); } else { exit('Something weird happened'); } $stmt-close();} 該函數(shù)在 likePost.php 中被調(diào)用(http 重寫后../../likes/),鏈接如下:<a href='../../likes/" . $post->id . "'><img src='/images/like.png' title='Like this post' alt='Like button' height='32' width='32'></a>likePost.php 中唯一的東西是session_start();include "../db.php";include "functions.php";likes();include "includes/header.php";在我看來,它應(yīng)該有效。但是當(dāng)我點(diǎn)擊鏈接時(shí),我總是得到一個(gè)空白頁面,上面寫著“發(fā)生了一些奇怪的事情”。但是數(shù)據(jù)庫更新沒有問題。誰能看到我看不到的東西?
1 回答

慕姐8265434
TA貢獻(xiàn)1813條經(jīng)驗(yàn) 獲得超2個(gè)贊
我剛剛發(fā)現(xiàn)這是header("location:javascript://history.go(-1)");
造成問題的原因。我把它改成了("Location: /");
,沒有更多的問題。所以...我只需要弄清楚如何返回上一頁而不是 root...
- 1 回答
- 0 關(guān)注
- 121 瀏覽
添加回答
舉報(bào)
0/150
提交
取消