Ben bir sunucuya benim php kod upload zaman ben oturumu ve tanımlama uyarı olsun

2 Cevap php

Ben bu olsun:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /www/zxq.net/w/e/e/weedcl/htdocs/index.php:3) in /www/zxq.net/w/e/e/weedcl/htdocs/common.php on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /www/zxq.net/w/e/e/weedcl/htdocs/index.php:3) in /www/zxq.net/w/e/e/weedcl/htdocs/common.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at /www/zxq.net/w/e/e/weedcl/htdocs/index.php:3) in /www/zxq.net/w/e/e/weedcl/htdocs/common.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at /www/zxq.net/w/e/e/weedcl/htdocs/index.php:3) in /www/zxq.net/w/e/e/weedcl/htdocs/common.php on line 12

Her şey localhost çalışıyor onun tuhaf çünkü

common.php:

<?php
session_start();
header('Cache-control: private'); // IE 6 FIX

if(isSet($_GET['lang']))
{
$lang = $_GET['lang'];

// register the session and set the cookie
$_SESSION['lang'] = $lang;

setcookie("lang", $lang, time() + (3600 * 24 * 30));
}
else if(isSet($_SESSION['lang']))
{

index.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
include_once 'common.php';
?>
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
 <title>New Project</title>
 <link rel="stylesheet" type="text/css" href="styles/global.css" />
 <link rel="stylesheet" type="text/css" href="styles/slimbox2.css" />
 <script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
 <script type="text/javascript" src="scripts/jquery.corner.js"></script>
 <script type="text/javascript" src="scripts/jquery.validate.js"></script>
 <script type="text/javascript" src="scripts/custom.js"></script>
 <script type="text/javascript" src="scripts/slimbox2.js"></script>
</head>
<body id="home">
<div id="header">
 <div class="container">
  <div id="header-top">
   <h1><a href="http://widerdesign.co.nr/">wider design</a></h1>
   <ul id="lang">
    <li><a href="index.php?lang=en" <?php if($lang=='en') {echo 'class="current"';} ?>>English</a></li>
    <li><a href="index.php?lang=es" <?php if($lang=='es') {echo 'class="current"';} ?>>Español</a></li>
    <li><a href="index.php?lang=tw" <?php if($lang=='tw') {echo 'class="current"';} ?>>中文(繁體)</a></li>
    <li><a href="index.php?lang=cn" <?php if($lang=='cn') {echo 'class="current"';} ?>>中文(简体)</a></li>
   </ul>
  </div>
  <div id="header-bottom">
   <div id="tagline">
    <h2>Nulla vitae tortor mauris. Fusce dapibus ultrices nibh id dignissim.<strong>Phasellus eget nibh ac quam rutrum mollis</strong> at vitae nisl.</h2>
    <p>Pellentesque faucibus est eu tellus varius in suscipit augue dapibus. In turpis ligula, faucibus eu mollis non, tincidunt ac magna. Integer tempor laoreet lacus, non accumsan ligula eleifend a. Nulla vitae tortor mauris. Fusce dapibus ultrices nibh id dignissim. Phasellus eget nibh ac quam rutrum mollis at vitae nisl. Morbi ultricies tristique tortor sed elementum. Vivamus id neque et lectus commodo tempor.</p>
   </div>
   <div id="about">
    <h2><?php echo $lang['h1']; ?></h2>
    <p>Pellentesque faucibus est eu tellus varius in suscipit augue dapibus. In turpis ligula, faucibus eu mollis non, tincidunt ac magna. Integer tempor laoreet lacus, non accumsan ligula eleifend a. Nulla vitae tortor mauris. Fusce dapibus ultrices nibh id dignissim. Phasellus eget nibh ac quam rutrum mollis at vitae nisl. Morbi ultricies tristique tortor sed elementum. Vivamus id neque et lectus commodo tempor. Integer tincidunt, nunc ac hendrerit vestibulum, orci nisl commodo odio, a tempus leo libero nec sapien. Praesent a urna non diam mollis tristique.</p>
   </div>
  </div><!-- #header-bottom -->
 </div><!-- .container -->
</div><!-- #header -->
<div id="work">
 <div class="container">
  <div class="project">
   <div class="left">
    <h2>Royal Steel</h2>
    <p>Royal Steel Plastic Technology Industrial Co., Ltd., manufactures the dominant PET Plastic Recycling and Extrusion Equipment in the Industry. Since 1980, over 29 years experience in plastic recycling technology.</p>
    <ul>
     <li><a href="index.html">View site</a></a></li>
     <li><a href="index.html">Visit site</a></li>
    </ul>
   </div>
   <div class="right">
    <a href="images/project1.jpg" rel="lightbox"><img src="images/project1.jpg"/></a>
   </div>
  </div><!-- .project -->
  <div class="project">
   <div class="left">
    <h2>Best Language School</h2>
    <p>Best Language school in Taiwan by provides personal service that exceeds expectations and by helping our students to achieve personal excellence.</p>
    <ul>
     <li><a href="index.html">View site</a></a></li>
     <li><a href="index.html">Visit site</a></li>
    </ul>
   </div>
   <div class="right">
    <a href="#"><img src="images/project2.jpg"/></a>
   </div>
  </div><!-- .project -->
  <div class="project">
   <div class="left">
    <h2>Best Language School</h2>
    <p>Best Language school in Taiwan by provides personal service that exceeds expectations and by helping our students to achieve personal excellence.</p>
    <ul>
     <li><a href="index.html">View site</a></a></li>
     <li><a href="index.html">Visit site</a></li>
    </ul>
   </div>
   <div class="right">
    <a href="#"><img src="images/project3.jpg"/></a>
   </div>
  </div><!-- .project -->
  <div class="project">
   <div class="left">
    <h2>Best Language School</h2>
    <p>Best Language school in Taiwan by provides personal service that exceeds expectations and by helping our students to achieve personal excellence.</p>
    <ul>
     <li><a href="index.html">View site</a></a></li>
     <li><a href="index.html">Visit site</a></li>
    </ul>
   </div>
   <div class="right">
    <a href="#"><img src="images/project4.jpg"/></a>
   </div>
  </div><!-- .project -->
 </div><!-- .container -->
</div><!-- #work -->
<div id="footer">
 <div class="container">
  <div id="footer-top">
   <div id="contact">
    <h2>Get in Touch</h2>
    <p>Please use the following contact form to send me a message.</p>
    <form id="sendmail" method="post" action="http://www.emailmeform.com/fid.php?formid=254816">
     <label for="name"><strong>Your Name</strong></label>
     <input type="text"  id="name" name="FieldData0" />
     <label for="email"><strong>Your Email</strong></label>
     <input type="text"  id="email" name="FieldData1" />
     <label for="message"><strong>Your Message</strong></label>
     <textarea type="text" id="message" name="FieldData2"></textarea>
     <input id="button" type="submit" value="Send">
    </form>
   </div>
   <div id="tools">
    <h2>I use</h2>
    <ul>
     <li><a href="index.php">Vim</a></li>
     <li><a href="index.php">Firefox</a></li>
     <li><a href="index.php">Firebug</a></li>
     <li><a href="index.php">jQuery</a></li>
     <li><a href="index.php">Zymic</a></li>
     <li><a href="index.php">Email Me Form</a></li>
    </ul>
   </div>
   <div id="info">
    <h2>Contact Details</h2>
    <ul>
     <li><strong>Address:</strong> Kuo Kuang Rd., Taichung 402, Taiwan R.O.C.</li>
     <li><strong>Tel:</strong> 0918051170</li>
     <li><strong>Email:</strong> <a href="mailto:janoochen@gmail.com">janoochen@gmail.com</a></li>
    </ul>
   </div>
  </div><!-- #footer-top -->
  <div id="footer-bottom">
   <p>Copyright © 2009 New Project. All Rights Reserved.</p>
  </div>
 </div><!-- .container -->
</div><!-- #footer -->
</body>
</html>

2 Cevap

Hata her şeyi söylüyor:

headers already sent (output started at ..../index.php:3)

You can't send headers after the body output has started. It works on your home machine because either warnings are suppressed, or you have different output buffer settings.

Kullanım

<?php
include_once 'common.php';
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

setcookie() yanıtı zaten taahhüt edilmiştir değilse mümkündür tepki başlıkları, yazacağız. Eğer cevap gövdesi için bir şeyler yazmak ve sunucu istemciye gönderir zaman bir tepki taahhüt edilecektir. Bu durumda, doctype {[(0)] olarak adlandırılır} önce tepkisine yazılmıştır edilir. Sen sayfanın üstüne eklemek taşımak gerekir:

<?php
include_once 'common.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Localhost çalışıyor neden olarak, bu tepki, doğrudan işlenen veya bellekte arabelleğe olup sunucu geneli bağlı olabilir. Bile tepki vücudun küçük bir parça yazdıktan sonra yanıt başlıklarını değiştirmek için oda bırakır böylece localhost görünüşe tamponlu oldu.