【发布时间】:2015-07-12 20:52:39
【问题描述】:
当我尝试这段代码时
$creds = array( 'user_login' => $_POST['benutzername'], 'user_password' => $_POST['passwort'], 'remember' => true );
$user = wp_signon( $creds, false );
if ( is_wp_error($user) ): echo $user->get_error_message(); endif;
wp_set_current_user($user->ID);
return $user;
我收到这条消息:
警告:无法修改标头信息 - 标头已由 (输出开始于 /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/formatting.php:4179) 在 /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/pluggable.php 在第 925 行警告:无法修改标头信息 - 标头 已经发送(输出开始于 /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/formatting.php:4179) 在 /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/pluggable.php 在第 926 行警告:无法修改标头信息 - 标头 已经发送(输出开始于 /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/formatting.php:4179) 在 /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/pluggable.php 在第 927 行可捕获的致命错误:WP_User 类的对象无法 转换为字符串 /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/shortcodes.php 在第 286 行
我在 shortcode.php 中使用该代码。我的代码有什么问题?
【问题讨论】: