Cannot send session cache limiter - headers already sent
Bonjour,
J'aimerai permettre le choix d'un langage d'un site web, sans mettre ce choix dans l'url, pour cela, j'ai fait :
Dans index.php :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<head>
//Code
</head>
<body>
<div id="global">
<div id="header">
<?php
include 'header.php';
?>
</div>
//Code |
Dans header.php :
Code:
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 29 30 31 32 33 34
| <?php
if (!empty($_SESSION['lang']) && $_SESSION['lang']=='EN') {
include("/lib/lang/en-lang.php");
} else if (!empty($_SESSION['lang']) && $_SESSION['lang']=='FR') {
include("/lib/lang/fr-lang.php");
} else {
$_SESSION['lang']='EN';
include($relative_path."/lib/lang/en-lang.php");
}
?>
<script type="text/javascript">
jQuery().ready(function(){
$("#langfr").click(function(){
$.ajax({
type: "POST",
url: "../lib/lang/langfr.php",
}).done(function(e) {
location.reload();
});
});
$("#langen").click(function(){
$.ajax({
type: "POST",
url: "../lib/lang/langen.php",
}).done(function(e) {
location.reload();
});
});
});
</script>
<div id="lang">
<a href="#" id="langfr">FR</a>
<a href="#" id="langen">EN</a>
</div> |
Dans langfr.php :
Code:
1 2 3 4
| <?php
session_start();
$_SESSION['lang']='FR';
?> |
Dans langen.php
Code:
1 2 3 4
| <?php
session_start();
$_SESSION['lang']='EN';
?> |
Mais, j'ai cette erreur :
Citation:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
sur langfr.php et langen.php