已经晚了 - 我可能缺少一些非常简单的东西,但我现在无法弄清楚。我的功能:    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();} 该函数在 likePost.php 中被调用(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";在我看来,它应该有效。但是当我点击链接时,我总是得到一个空白页面,上面写着“发生了一些奇怪的事情”。但是数据库更新没有问题。谁能看到我看不到的东西?
                    
                    
                1 回答
 
                    
                    
                            慕姐8265434
                            
                                
                            
                        
                        
                                                
                    TA贡献1813条经验 获得超2个赞
我刚刚发现这是header("location:javascript://history.go(-1)");造成问题的原因。我把它改成了("Location: /");,没有更多的问题。所以...我只需要弄清楚如何返回上一页而不是 root...
- 1 回答
- 0 关注
- 142 浏览
添加回答
举报
0/150
	提交
		取消
	