Home  >  Article  >  Backend Development  >  php session_start有关问题

php session_start有关问题

WBOY
WBOYOriginal
2016-06-13 13:36:45831browse

php session_start问题
新手求助!!
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\reg\homepage.php:5) in C:\AppServ\www\reg\homepage.php on line 676
我在网上查了,但解决方案都是改变系统文件之类的,以我以前编c++的经验来看,一般没什么用,果然它真的不起作用。所以,O(∩_∩)O~应该如何解决呢?在此先谢过各位了。。。

------解决方案--------------------
怎么不行啊。这样试试:

PHP code

<?php session_start();
  echo '<div id="apDiv2">';
  if(isset($_SESSION['username'])){
        echo $_SESSION['username'], "welcome!";
        echo '<a href="login.php?action=logout">注销</a>';
  }else{
          echo'<a href="login.html">登陆</a> ';  
  }
  echo '';
?> <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn