2014-02-15 7 views
2

이 파일을 다른 페이지에 포함하려고하면 작동하지 않습니다. 어떤 아이디어? 파일 구조 :이 파일은 포함되어 있지 않습니다.

index.php 
     (FOLDER - core)  init.php 
     (FOLDER - functions) sanitise.php 
     (FOLDER - browse) blog.php , ecommerce.php... 
     (FOLDER - includes) header.php 

내가 가지고있는 문제는 내 파일에 core/init.php를 포함하려고 할 때 발생합니다. 내가 놓친 실수를 발견 했습니까?

내 include/header.php 파일에 core/init.php를 포함 할 수 있습니다. 그래서/header.php를 include/core.ini 파일에 포함 시키면 core/init.php가 포함됩니다. init.php를 모든 웹 페이지에 포함시키고 싶습니다.

Init.php 코드 :

<?php 
session_start(); 

$GLOBALS['config'] = array(
    'mysql' => array(
     'host' => 'localhost', 
     'username' => 'root', 
     'password' => 'root', 
     'db' => 'webAwwards' 
    ), 
    'remember' => array(
     'cookie_name' => 'hash', 
     'cookie_expire' => 604800 
    ), 
    'session' => array(
     'session_name' => 'user' 

    ) 
); 

spl_autoload_register(function($class) { 
     require_once 'classes/' . $class . '.php'; 
    }); 

require_once '/functions/sanitise.php'; 

?> 

내 header.php 파일 코드 :

<!DOCTYPE html> 
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]--> 
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]--> 
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]--> 
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]--> 
<head> 

    <!-- Basic Page Needs 
    ================================================== --> 
    <meta charset="utf-8"> 
    <title>Web Awwards | Web Gallery | Submit your site</title> 
    <meta name="description" content=""> 
    <meta name="author" content=""> 

    <!-- Mobile Specific Metas 
    ================================================== --> 
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 

    <!-- CSS 
    ================================================== --> 
    <link rel="stylesheet" type="text/css" href="../css/base.css"> 
    <link rel="stylesheet" type="text/css" href="../css/skeleton.css"> 
    <link rel="stylesheet" type="text/css" href="../css/layout.css"> 
    <link rel="stylesheet" type="text/css" href="../css/styles.css"> 
    <link rel="stylesheet" type="text/css" href="../css/menu.css"> 
    <link rel="stylesheet" type="text/css" href="../css/submission.css"> 

    <!--[if lt IE 9]> 
     <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> 
    <![endif]--> 

    <!-- Favicons 
    ================================================== --> 
    <link rel="shortcut icon" href="images/favicon.ico"> 
    <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> 
    <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png"> 
    <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png"> 

</head> 
<body> 
<!-- Menu Horizontal --> 
<div class="horizontal"> 
    <div class="webName"> 
     <h3>WebA<font style="color: #c14a44;">ww</font>ards</h3> 
    </div> 
    <div id='cssmenu' class="twelve columns"> 
     <ul> 
      <li class='active'><a href="/index.php"><span>Home</span></a></li> 
      <li class='has-sub'><a href='#'><span>Browse</span></a> 
       <ul> 
        <li class='has-sub'><a href='../browse/blog.php'><span>Blog</span></a></li> 
        <li class='has-sub'><a href='../browse/ecommerce.php'><span>E-Commerce</span></a></li> 
        <li class='has-sub'><a href='../browse/corporate.php'><span>Corporate</span></a></li> 
        <li class='has-sub'><a href='../browse/portfolio.php'><span>Portfolio</span></a></li> 
        <li class='has-sub'><a href='../browse/minimalist.php'><span>Minimalist</span></a></li> 
        <li class='has-sub'><a href='../browse/other.php'><span>Other</span></a></li> 
       </ul> 
      </li> 
      <li><a href='/login.php'><span>Register/ Login</span></a></li> 
      <li><a href='/submit.php'><span><font style="color: #68cd7a;">Submit Your Site</font></span></a></li> 
     </ul> 
    </div> 
</div> 
<div class="container"> 

찾아보기/blog.php 코드 :

<?php 
    require_once('../core/init.php'); 
    require ('../includes/header.php'); 
?> 
<!-- TODO PHP Scripts --> 
<div class="category nine columns"> 
    <div class="category-img"> 
     <img src="/css/img/webImg/screen1.png" alt="Site Description"/> 
    </div> 
    <h3> Web Name </h3> 
    <h5> Designed By: Tautvydas Slegaitis </h5> 
    <h7> Designers url </h7> 
    <div class="vote"> 
     <h4> Vote for my site </h4> 
     </br> 
     <a href="#"> Love it </a> 
     <a href="#"> Nope, Not for me </a> 
    </div> 
</div> 

</div><!-- Close Container Div --> 
<div class="footer"> 


</div> 



</body> 
</html> 

파일이 실행되지 않고 항상 오류가 표시됩니다.

Warning: require_once(../core/init.php): failed to open stream: No such file or directory in - on line 2 Fatal error: require_once(): Failed opening required '../core/init.php' (include_path='.:') in - on line 2 "

+1

당신의 init.php에서'../functions/ sanitise.php'로 sanitise.php를 호출하십시오. –

+1

나는 그것을 받아 들일 것입니다. 일했다 .. :) thx – Tauciokas

+0

그것은 이제 네 차례 야 :) –

답변

1

잘못된 방식으로 sanitise.php를 포함하고 있습니다.

/functions/sanitise.php은 루트 디렉토리의 기능 폴더를 검색합니다.

../functions/sanitise.php으로 지정해야합니다.

관련 문제