重複の可能性:
PHP によって既に送信されたヘッダー
私はオブジェクト指向のphpが初めてです。私には解決できない問題があります。私の問題は、ログイン/ログアウトしたいときに、以下に示すようなエラーメッセージが表示されることです:: [機能的なphpではうまく機能しますが、問題はoop phpにあることに注意してください]
エラー ::
Warning: Cannot modify header information - headers already sent by (output
started at E:\XAMPP\xampp\htdocs\photo_gallery_new\Includes\database_object.php:6)
in E:\XAMPP\xampp\htdocs\photo_gallery_new\Includes\Functions.php on line 14
私のコード::
index.php
<?php require_once ("../../Includes/initiate.php"); ?>
<?php
if( !$session->is_logged_in() ) {
redirect_to("login.php");
}
?>
login.php
<?php
require_once ("../../Includes/initiate.php");
if( $session->is_logged_in() ) {
redirect_to("index.php");
}
// Remember to give your form's submit tag a name="submit" attribute!
if( isset($_POST['submit']) ) { // form has been submitted
$username = trim($_POST['username']); $password = trim($_POST['password']);
// Check database to see if username/password exist
$found_user = USER::authenticate($username, $password);
if($found_user) {
$session->login($found_user);
redirect_to("index.php");
} else {
// username/password combo was not found in the database
$message = "Username/password combination incorrect.";
}
}
else { // form has not been submitted
$username = "";
$password = "";
}
?>
<html>
<---- form design [ form action = 'login.php' ] --->
</html>
開始.php
<?php
require_once ("session.php");
require_once ("Config.php");
require_once ("Functions.php");
require_once ("Database.php");
require_once ("database_object.php"); // this makes error
require_once ("user.php");
?>
関数.php
<?php
function strip_zeros_from_date( $marked_string="") { ..... }
function redirect_to( $location = NULL) { // check loged in/not
if($location != NULL) {
header("Location: {$location}");
exit;
}
}
function output_message($message = "") { .... }
function __autoload($class_name) { ...... }
function include_layout_template( $template = "" ) { ... }
?>
開始.php
<?php
require_once ("database.php");
class databaseObject {
}
$newClass = new databaseObject();
?>