当我在php中重定向页面时,出现以下错误. [英] when i am redirecting a page in php,I am getting the below error.

查看:117
本文介绍了当我在php中重定向页面时,出现以下错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

警告:无法修改标头信息-在第17行的/home/iconweb/public_html/submiteon2/Get_Details.php中已发送的标头(输出始于/home/iconweb/public_html/submiteon2/Get_Details.php:8)

Warning: Cannot modify header information - headers already sent by (output started at /home/iconweb/public_html/submiteon2/Get_Details.php:8) in /home/iconweb/public_html/submiteon2/Get_Details.php on line 17

推荐答案

如果要进行重定向,则PHP代码块必须位于输出到浏览器的所有内容之前-包括echo,HTML(甚至空格)或BOM表)和<?php ... ?>块之外的其他导致输出的功能:

If you are going to do a redirect, the PHP code block must come before anything that outputs to the browser - that includes echo, HTML (or even spaces or a BOM) outside of <?php ... ?> blocks and any other functions that cause output:

<?php
if(


某物){ 标头(' 位置:http://other.url'); 退出; } ?> < !DOCTYPE html > < 头部 > ...页面的其余部分...
something) { header('Location: http://other.url'); exit; } ?> <!DOCTYPE html> <head> ... rest of page ...


检查代码中是否有任何Echo语句
如果存在,则将其删除或评论
Check Whether Is There Any Echo Statement in your code
if it is there then remove or comment it


这篇关于当我在php中重定向页面时,出现以下错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆