2017-11-21 1 views
-1

여기는 상당히 일반적인 질문이지만 내 Uni 모듈 용 웹 사이트를 만들고 초기화 파일과 설정 파일이 모든 페이지에서 오류를 일으키고 있습니다. 왜 그런지 알아 내지 못 하죠. 나는 모든 페이지에 내 init 파일을 포함시키고 나의 init 파일은 나의 설정 파일을 포함한다! init 파일의 2 행이나 파일 중 아무 것도 출력되지 않습니다. 나는 왼쪽이 게시물에 대한 내 설정 변수를 변경 있지만이 됩니다이 오류가PHP 오류 - 이미 보낸 헤더 정보 헤더를 수정할 수 없습니다.

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /customers/a/b/7/mywebsite/httpd.www/currentpage.php:1) in /customers/a/b/7/mywebsite/httpd.www/config/init.php on line 2 

config.php를

<?php 
session_start(); 
require_once 'config.php'; 
?> 

init.php

<?php 

    //Database depends on host 
    $db['hostname'] = 'myhostname'; 
    $db['username'] = 'username'; 
    $db['password'] = 'mypassword'; 
    $db['database'] = 'database'; 
    $db['dbdriver'] = 'mysqli'; 

    //$connection = new mysqli($hostname, $username, $password, $databaseName); 

    $connection = new mysqli($db['hostname'], 
    $db['username'],$db['password'],$db['database']); 


    ?> 
입니다 원인을하지 않은

Currentpage.php

<!DOCTYPE html> 
    <head> 
     <html lang="en"> 
    </head> 
    <?php 
    require 'header.php'; 

    ?> 



    <!-- Primary Page Layout 
    –––––––––––––––––––––––––––––––––––––––––––––––––– --> 


     <?php 
     require 'leftnav.php'; 
     ?> 

<?php require 'footer.php'; ?> 


     </div> 
    </div> 

    <!-- End Document 
    –––––––––––––––––––––––––––––––––––––––––––––––––– --> 

+1

"

+1

PHP 태그를 열기 전에 공백이 없어야합니다. –

+1

@SureshKamrushi PHP 태그 앞에 공백이 없습니다 – norskdreamer

답변

0

나는 init.phpheader.php에 포함 시켰다고 생각합니다. 모든 HTML 태그 앞에처럼을 init.php

<?php include('init.php'); ?> 
<!DOCTYPE html> 

또는 더 나은 아직 header.php에 다음을 추가하고 다음과 같습니다 : 그것을 제거 등을 currentpage.php에 전에

<?php include('init.php'); ?> 
<!DOCTYPE html> 
    <head> 
     <html lang="en"> 
    </head> 

해야 더 출력이 없어야합니다 session_start() 전에 보냈습니다.

+0

예를 들어 내 홈페이지를 실행하면 자체 header.php 파일을 실행할 때 오류가 발생하지 않아도됩니다. 첫 번째 코드 줄은 오류가 아직 있습니다. – norskdreamer

+0
+0

아니 확실하게 없습니다 – norskdreamer

0

<!DOCTYPE html>보다 먼저 session_start();을 사용하여 헤더를 보냈습니다.

관련 문제