headers already sent
ik weet dat deze vraag vast vaker gesteld is en ik heb ALLE pagina's al bekeken op whitespace voor EN na de open en closing tag van php maar kan niks vinden.
de error melding is alsvolgd:
Warning: Cannot modify header information - headers already sent by (output started at controvi.com/public_html/mu/index.php:11) in controvi.com/public_html/mu/layoutpart/content/logout.php on line 21
en dit is de code van logout.php:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
include_once('content_abstract_class.php');
class LogOut extends ContentInformation
{
function content()
{
if($_SESSION['loggedIn'] == true)
{
session_destroy();
header('location: index.php?id=Home');
}else
{
return 'U bent al uitgelogd';
}
}
}
?>
include_once('content_abstract_class.php');
class LogOut extends ContentInformation
{
function content()
{
if($_SESSION['loggedIn'] == true)
{
session_destroy();
header('location: index.php?id=Home');
}else
{
return 'U bent al uitgelogd';
}
}
}
?>
als iemand mij kan helpen zou dat fijn zijn. akvast bedankt
Gewijzigd op 17/07/2010 00:48:02 door Jeroen kolkman
Gewijzigd op 17/07/2010 00:48:24 door jeroen kolkman
De fout wijst naar index.php regel 11.
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?php
include_once('layoutpart/headpart_class.php');
include_once('layoutpart/bodypart_class.php');
$headPart = new HeadPart();
$bodyPart = new BodyPart();
?>
include_once('layoutpart/headpart_class.php');
include_once('layoutpart/bodypart_class.php');
$headPart = new HeadPart();
$bodyPart = new BodyPart();
?>
<!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>
Code (php)
1
2
3
4
5
2
3
4
5
<?php //call function to create head information
$headPart->buildTitle('Controvi.com');
$headPart->buildCss();
echo $headPart->render();
?>
$headPart->buildTitle('Controvi.com');
$headPart->buildCss();
echo $headPart->render();
?>
</head>
<body>
Code (php)
1
2
3
4
5
2
3
4
5
<?php
//call function to create complete body.
$bodyPart->buildBody();
echo $bodyPart->render();
?>
//call function to create complete body.
$bodyPart->buildBody();
echo $bodyPart->render();
?>
</body>
</html>
en mijn head gedeelte word hier gemaakt:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
include_once('render_class.php');
include_once('bodypart_class.php');
class HeadPart extends BodyPart
{
private $headContent;
function buildTitle($title)
{
$conten = '<title>';
$content .= $title;
$content .= '</title>';
$content .= '<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />';
$this->headContent = $content;
}
function buildCss()
{
$cssLink = '<link rel="stylesheet" type="text/css" href="./css/main.css" />';
$content = $cssLink;
$this->headContent .= $cssLink;
}
function render()
{
return $this->headContent;
}
}
?>
include_once('render_class.php');
include_once('bodypart_class.php');
class HeadPart extends BodyPart
{
private $headContent;
function buildTitle($title)
{
$conten = '<title>';
$content .= $title;
$content .= '</title>';
$content .= '<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />';
$this->headContent = $content;
}
function buildCss()
{
$cssLink = '<link rel="stylesheet" type="text/css" href="./css/main.css" />';
$content = $cssLink;
$this->headContent .= $cssLink;
}
function render()
{
return $this->headContent;
}
}
?>
en aangezien ik al wel gehoord heb dat je de headers niet mag neerzetten na de html (of zoiets) maar dit wel werkt lokaal (ontwikkel omgeving ) maar niet op mijn gebruikers omgeving, wil ik wel eens weten wat er nou aan de hand is.
Ik heb het probleem helemaal opgelost :)
ik heb de index nu als volgt gemaakt omdat wat ik al zei over de de header voor de html plaatsen .
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
include_once('layoutpart/headpart_class.php');
include_once('layoutpart/bodypart_class.php');
$headPart = new HeadPart();
$bodyPart = new BodyPart();
$content = '<!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>';
//call function to create head information
$headPart->buildTitle('Controvi.com');
$headPart->buildCss();
$content .= $headPart->render();
$content .= '</head>
<body>' ;
//call function to create complete body.
$bodyPart->buildBody();
$content .= $bodyPart->render();
$content .= '</body>
</html>';
echo $content;
include_once('layoutpart/headpart_class.php');
include_once('layoutpart/bodypart_class.php');
$headPart = new HeadPart();
$bodyPart = new BodyPart();
$content = '<!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>';
//call function to create head information
$headPart->buildTitle('Controvi.com');
$headPart->buildCss();
$content .= $headPart->render();
$content .= '</head>
<body>' ;
//call function to create complete body.
$bodyPart->buildBody();
$content .= $bodyPart->render();
$content .= '</body>
</html>';
echo $content;
Niet meer nodig zie ik.
Gewijzigd op 17/07/2010 01:10:16 door - SanThe -
Ik heb het probleem helemaal opgelost :)
ik heb de index nu als volgt gemaakt omdat wat ik al zei over de de header voor de html plaatsen .
$content .= '</head>
<body>' ;
//call function to create complete body.
$bodyPart->buildBody();
$content .= $bodyPart->render();
$content .= '</body>
</html>';
echo $content;
Nou in ieder geval bedankt en deze mag gesloten worden.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
include_once('layoutpart/headpart_class.php');
include_once('layoutpart/bodypart_class.php');
$headPart = new HeadPart();
$bodyPart = new BodyPart();
$content = '<!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>';
//call function to create head information
$headPart->buildTitle('Controvi.com');
$headPart->buildCss();
$content .= $headPart->render();
include_once('layoutpart/headpart_class.php');
include_once('layoutpart/bodypart_class.php');
$headPart = new HeadPart();
$bodyPart = new BodyPart();
$content = '<!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>';
//call function to create head information
$headPart->buildTitle('Controvi.com');
$headPart->buildCss();
$content .= $headPart->render();
Gewijzigd op 17/07/2010 01:11:25 door jeroen kolkman
Gewijzigd op 17/07/2010 01:12:34 door jeroen kolkman
We sluiten in principe topics niet zomaar, anderen hebben mogelijk nog wat aan je antwoord of hebben misschien een vraag die in het verlengde van dit probleem ligt :-)