PHP标头信息不可修改-无原因错误
可能重复:PHP标头信息不可修改-无原因错误,php,wordpress,Php,Wordpress,可能重复: 在构建一个登录表单以插入wordpress系统时,突然之间,尽管之前已经工作过。忽略这些明星的错误,他们只是为了避免公开展示网站 Warning: Cannot modify header information - headers already sent by (output started at /home/divethe1/public_html/**********.com/wp-content/themes/RIKsoft/header.php:2) in /home/
在构建一个登录表单以插入wordpress系统时,突然之间,尽管之前已经工作过。忽略这些明星的错误,他们只是为了避免公开展示网站
Warning: Cannot modify header information - headers already sent by (output started at /home/divethe1/public_html/**********.com/wp-content/themes/RIKsoft/header.php:2) in /home/divethe1/public_html/********.com/wp-includes/pluggable.php on line 738
法典说这是由开合前后的空间造成的,但没有任何原因。有问题的行,即我可以删除的行是$user=wp\u signon($creds,false)代码>以使其不会导致此错误,但它不会执行我希望它执行的操作
代码
<?php get_header(); ?>
<?php
$creds = array();
$creds['user_login'] = $_POST['LOGuser'];
$creds['user_password'] = $_POST['LOGpass'];
$creds['remember'] = true;
$user = wp_signon( $creds, false );
if ( is_wp_error($user) )
echo $user->get_error_message();
?>
<?php if ( is_user_logged_in() ) { wp_redirect( $_POST['redirect'] ); exit; }
else { ?>
<div class="panel log autoc">
<div class="title"><b>LOG IN</b></div>
<form action="http://www.robin-knight.com/access/" method="post">
<label>Email Address<input name="LOGuser" type="text"></label>
<label>Password<input name="LOGpass" type="password"></label>
<input type="submit" class="button" value="Log In">
</form>
</div>
<?php }?>
<?php get_footer();?>
登录
电子邮件地址
密码
标记集被视为PHP的输出。标题已经发送,因为某些内容已经发送(您的
标记之间的空格-是的,空格也是内容),内容要求首先发送标题,并且在发送完标题后不能修改标题
将二者合并为一,通过改变
<?php get_header(); ?>
<?php
$creds = array();
...
正如赛斯所说。一旦发送了任何内容,就不能发送任何浏览器标题,例如要重定向的位置。在这种情况下,你的空间。尝试了,但没有工作either@RobinKnight函数get_header
echo
或print
或以其他方式输出任何内容吗?如果是这样,那么您将不得不延迟调用它,直到您使用wb\u redirect
@Seth修改了标题信息之后,做得很好。是的。我早些时候试过移动它,但没有用,所以它一定是一个组合
<?php get_header(); ?>
<?php
$creds = array();
...
<?php
get_header();
$creds = array();
...