我做的一个贴吧的效果 在帖子内容页点击返回可以直接返回到帖子列表页 但是如果提交回复内容后点返回却回不到帖子列表页 需要再点一次才能回去 如果提交两次回复需要按三次返回才能回到帖子列表页 提交回复次数越多需要按返回次数越多 这是怎么回事呢?
回复讨论(解决方案)
没看到代码,不好说
没看到代码,不好说
就是前几天一直问的那个代码?
如果你是用form表单,提交后相当于进入一个新页面了,点一次返回还是原来的页面
改成ajax异步提交就能达到你想要的效果了
那么多帖子,哪个知道谁对谁
那么多帖子,哪个知道谁对谁
就是下面的代码 这个是帖子主页 就是在这个页面提交内容后 点击一次回不到帖子列表页
tieba3.php
;
nbsp;html>
include "cookie.php";
?>
$pdo=new PDO("mysql:host=localhost;dbname=t1","root","");
$title=$_GET['id'];
$stmt=$pdo->prepare("select id,title,content from topic where id=?");
$stmt->execute(array($title));
$res=$stmt->fetchall(PDO::FETCH_ASSOC);
foreach($res as $v){
echo ''.$v['content'].'';
}
?>
$pdo=new PDO("mysql:host=localhost;dbname=t1","root","");
$id2=$_GET['id'];
$stmt=$pdo->prepare("select id,reid,content from reply where reid=?");
$stmt->execute(array($id2));
$res1=$stmt->fetchall(PDO::FETCH_ASSOC);
foreach($res1 as $v2){
echo $v2['content'];
}
?>
tieba4.php
if(isset($_POST['reid'])){
$pdo=new PDO("mysql:host=localhost;dbname=t1","root","");
$stnt=$pdo->prepare("insert into reply(reid,name,content)values(:reid,:name,:content)");
$stnt->execute($_POST);
header("location:http://localhost/tieba3.php?id=".$_POST['reid']);
}
?>
header("location:http://localhost/ tieba3.php?id=".$_POST['reid']);
而 tieba3.php 显然是内容页而不是列表页
header("location:http://localhost/ tieba3.php?id=".$_POST['reid']);
而 tieba3.php 显然是内容页而不是列表页
对啊 这只是一个插入到数据库的页面 回复提交到当前页面 提交后并且显示出来 就是这么一个页面 比如我发表回复以后想返回到帖子列表页面 点击一次后退按钮却回不到帖子列表页面
你把 tieba3.php 改成列表页的程序文件不就行了?
你把 tieba3.php 改成列表页的程序文件不就行了?
那样效果就变了啊
如果你是用form表单,提交后相当于进入一个新页面了,点一次返回还是原来的页面
改成ajax异步提交就能达到你想要的效果了
我不懂异步提交啊 所以不懂它是怎么实现的 不是知道是不是我想要的效果
3楼的人已经回答你了,如果你点的是浏览器的返回当然退回到上一次的页面——就是你提交之前的页面。如果你点击的是自己写的返回按钮,那就是那个返回按钮的跳转链接不对

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
