PHP cannoy modify header information - headers already sent by ....
我采用的是MVC模式的写法,代码和html分离的写法
<?php
require '../mysql_connect.php';
require('../model/functions.php');
include_once '../views/login.html.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') { // 处理表单
if (isset($_POST['login_submit'])) { $role = $_POST['role'];
$username = $_POST['username'];
$passwd = $_POST['p']; if( user_login($pdo,$role,$username,$passwd) ){
setcookie('userName',$name);
setcookie('password',$psw);
header("location: index.php");
}else{
echo "<script>alert('输入信息错误,登录失败');</script>";
} }elseif (isset($_POST['get_password'])) { $email = $_POST['email'];
user_register($pdo,$email);
}
}
我在一个页面内写了两个form表单,但是两个表单都是提交到同一个PHP文件处理,到时提交第二个表单时就一直报这种错误,
解决方法:
只需要将第四行的html代码移到最后
PHP cannoy modify header information - headers already sent by ....的更多相关文章
- 阿里云服务器出现Warning: Cannot modify header information - headers already sent by (output started at 问题的解决方法
阿里云服务器出现Warning: Cannot modify header information - headers already sent by (output started at 问题的解决 ...
- php有些系统会报错或提示 Cannot modify header information - headers already sent by
Warning: Cannot modify header information - headers already sent by (output started at /home/test/do ...
- PHP错误Warning: Cannot modify header information - headers already sent by解决方法
这篇文章主要介绍了PHP错误Warning: Cannot modify header information - headers already sent by解决方法,需要的朋友可以参考下 今天在 ...
- Warning: Cannot modify header information - headers already sent by (output started at
一般来说在header函数前不能输出html内容,类似的还有setcookie() 和 session 函数,这些函数需要在输出流中增加消息头部信息.如果在header()执行之前有echo等语句,当 ...
- PHP:Cannot modify header information - headers already sent by错误的解决方案
<?php ob_start();setcookie("username","test",time()+3600);echo "the user ...
- Warning: Cannot modify header information - headers already sent by ... functions_general.php on line 45
摘自:有用到 http://blog.csdn.net/besily/article/details/5396268 PHP错误:Warning: Cannot modify header infor ...
- php5.6,Ajax报错,Warning: Cannot modify header information - headers already sent in Unknown on line 0
php5.6ajax报错 Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be remo ...
- (转)PHP5使用cookie时报错 cannot modify header information - headers already sent by (......)
转自:http://blog.csdn.net/buyingfei8888/article/details/8899797 运行有警告Warning: Cannot modify header inf ...
- 转载: PHP错误:Warning: Cannot modify header information - headers already sent by ...
如果在执行php程序时看到这条警告:"Warning: Cannot modify header information - headers already sent by ....&quo ...
随机推荐
- 【5岁小孩都会】vs2013如何进行单元测试
1,如何进行单元测试呢,打开vs 新建一个项目 然后在解决方案右键点击,如下图所示: 2,左侧点击 测试 ->单元测试项目 3)点击确定,如下图 4)在当前代码上右键点击,调试 或者运行测试 ...
- Asp.net开发必备51种代码
1.//弹出对话框.点击转向指定页面 Response.Write("<script>window.alert('该会员没有提交申请,请重新提交!')</script> ...
- windows命令行快速启动软件
windows桌面上太多的应用程序快捷方式很影响美观,于是寻思使用类似Linux系统中命令行的方式来启动软件. 只需要3步: 1.建立一个目录A,用来存放快捷方式.比如,建立D:\path.并复制快捷 ...
- [总结].net操作MongoDb通用基础类1:
public class MongoDBHelper { //定义Mongo服务 private MongoServer mongo = null; //获取databaseName对应的数据库,不存 ...
- iOS7开发-Apple苹果iPhone开发Xcode官方文档翻译
编号 iOS-Apple苹果官方文档翻译名称 博文链接地址 1 苹果API常用英语名词---iOS-Apple苹果官方文档翻译 http://www.cnblogs.com/ChenYilong/p/ ...
- 验证 .NET 4.6 的 SIMD 硬件加速支持的重要性
SIMD 的意思是 Single Instruction Multiple Data.顾名思义,一个指令可以处理多个数据. .NET Framework 4.6 推出的 Nuget 程序包 Syste ...
- 2012-2013 ACM-ICPC, NEERC, Central Subregional Contest C Sequence (打表)
打个表找找规律,到24445的时候乘2以后产生了0出现循环. 一般地,判断循环节是否存在可以用Floyd判圈算法. #include<bits/stdc++.h> using namesp ...
- vue2.0动画
相对于vue1.0来说,vue2.0的动画变化还是挺大的, 在1.0中,直接在元素中加 transition ,后面跟上名字. 而在vue2.0中,需要把设置动画的元素.路由放在<transit ...
- Ace 在HTML中使用方法
<!DOCTYPE html> <html> <head> <title>Demo of ACE Editor</title> <!- ...
- python基础一 day10(2)
复习: # 三元运算符# 接收结果的变量 = 条件为真的结果 if 条件 else 条件为假的结果# 接收结果的变量 = “真结果” if 条件 else “假结果”## 命名空间 和 作用域# 三种 ...