このサイトとgoogle.comの両方で、別のWebページへのリダイレクトに関する私の質問に関して、さまざまな解決策を検索しましたが、特定のシナリオでエラーが発生し続ける理由を理解できます-
エラー::「警告: ヘッダー情報を変更できません - 10 行目の login_submit3.php で既に送信されたヘッダー (test_ecis_lib_pdo.php:3 で出力が開始されました)」。
login_submit3.php のコード:
<?php
//! include config file; includes session_start() and ecp php library
include 'config.php';
if(DBLoginSubmitA($mysql_hostname, $mysql_username, $mysql_password,$mysql_dbname))
{
//redirect to webpage depending on SESSION paramter ['customertype'
switch($_SESSION['customertype'])
{
case 'member':
header("location:members3.php",true,'301');
die();
break;
case 'admincrm':
header("location:admincrm3.php");
die();
break;
default:
break;
}
};
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPRO Login</title>
</head>
<body>
</body>
</html>
config.php のコード:
/*** begin our session ***/
session_start();
//! include lib after session_start()
include 'test_ecis_lib_pdo.php';
/*** mysql hostname ***/
$mysql_hostname = 'localhost';
/*** mysql username ***/
$mysql_username = 'root';
/*** mysql password ***/
$mysql_password = 'xxxx';
/*** database name ***/
$mysql_dbname = 'xxx';
?>
test_ecis_lib_pdo.php (関数を含むライブラリ - エラーが参照する場所) のコードは次のように始まります。
<?php
//GLOBAL VARIABLES
$error = "no error";
$timezone = date_default_timezone_set("Europe/Amsterdam");
$CUSTOMER_TYPE=array(
"interested"=>"1",
"member"=>"2",
"chair"=>"3",
"admincrm"=>"4",
"adminfinance"=>"4",
"adminenergymanagement"=>"5"
);
header() を呼び出す前に、test_ecis_lib_pdo.php ファイルが send タグまたは echo テキストを送信しないことを確認しましたが、それでもエラーが発生します。助けてください。