在 PHP 中实现无页面跳转可以使用以下方法:
使用 HTTP 头部重定向:
header("Location: http://example.com/new-page.php");
exit();
使用 JavaScript 自动跳转:
echo '<script>window.location.href = "http://example.com/new-page.php";</script>';
使用 meta 标签自动跳转:
echo '<meta http-equiv="refresh" content="0;URL=\'http://example.com/new-page.php\'" />';
请注意,这些方法都需要在没有输出任何内容之前使用,否则会导致错误。
上一篇:php 表单 安全 过滤
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站