2017-09-29 10 views
-3

안녕하세요 여러분, 오픈 소스 PHP 공유 프로젝트 사이트를 코딩하고 있습니다. 귀하의 도움이 필요합니다. 내 웹 페이지에서 500 오류가 발생했습니다. 내 코드가 생각납니다. 어쨌든 고치는거야?또 다른 500 오류

전체 코드 : 사용자 역할 1 개 디스플레이 페이지

<?php 
    session_start(); 
    include_once "vendor/autoload.php"; 
    $page = new membership\Page(1); 
    if ($page->isValid() == true){ 

     echo ' //Code that display to register users here. ';} 
도와

감사의 경우 사용자가 등록되어있는 경우

<?php include('includes/header.php'); ?> 
<?php 
include_once 'dbconnect.php'; 

// fetch files 
$sql = "select filename from tbl_files"; 
$result = mysqli_query($con, $sql); 
?> 

<?php 
    session_start(); 
    include_once "vendor/autoload.php"; 
    $page = new membership\Page(1); 
    if ($page->isValid() == true){ 

     echo ' 

<center> 
<div class='container'> 
    <div class='row'> 
     <div class='col-xs-8 col-xs-offset-2 well'> 
<form action='upload.php' method='post' enctype='multipart/form-data'> 
      <legend>Select File to Upload:</legend> 
      <div class='form-group'> 
       <input type='file' name='file1' /> 
      </div> 
      <div class='form-group'> 
       <input type='submit' name='submit' value='Upload' class='btn btn-info'/> 
      </div> 
      <?php if(isset($_GET['st'])) { ?> 
       <div class='alert alert-danger text-center'> 
       <?php if ($_GET['st'] == "success") { 
         echo "File Uploaded Successfully!"; 
        } 
        else 
        { 
         echo 'Invalid File Extension!'; 
        } ?> 
       </div> 
      <?php } ?> 
     </form></div></div></center> 
';} 

이 코드를 확인!

+1

'어쨌든 해결할 수 있습니까?'예, 가능합니다. 좋아, 다음 질문! – GrumpyCrouton

+0

500 오류는 서버 측에서 오류 로그를 확인 했습니까? – teeyo

+0

하나의 인용 부호로 둘러싸인 문자열에 작은 따옴표가 포함되어 있습니다. 오류 로그를보고 – iainn

답변

0

다른 사람들이 의견에서 제안했듯이 잘못 인용 된 문자열이 있습니다. 처음 몇 줄 에서처럼 PHP 코드를 계속하기 위해 php 태그를 열거 나 닫을 필요가 없습니다. 당신이 PHP를 통해 HTML을 출력하는 경우

echo '<div class="someclass"></div>'; 

좋아한다 또는 쉼표를 탈출.

위의 코드를 수정하려면 PHP 태그를 닫아 HTML을 출력하면됩니다.

<?php 
include('includes/header.php'); 

include_once 'dbconnect.php'; 

// fetch files 
$sql = "select filename from tbl_files"; 
$result = mysqli_query($con, $sql); 

session_start(); 
include_once "vendor/autoload.php"; 
$page = new membership\Page(1); 
if ($page->isValid() == true) { 
    ?> 

    <center> 
     <div class='container'> 
      <div class='row'> 
       <div class='col-xs-8 col-xs-offset-2 well'> 
        <form action='upload.php' method='post' enctype='multipart/form-data'> 
         <legend>Select File to Upload:</legend> 
         <div class='form-group'> 
          <input type='file' name='file1' /> 
         </div> 
         <div class='form-group'> 
          <input type='submit' name='submit' value='Upload' class='btn btn-info'/> 
         </div> 
         <?php if (isset($_GET['st'])) { ?> 
          <div class='alert alert-danger text-center'> 
           <?php 
           if ($_GET['st'] == "success") { 
            echo "File Uploaded Successfully!"; 
           } else { 
            echo 'Invalid File Extension!'; 
           } 
           ?> 
          </div> 
         <?php } ?> 
        </form></div></div></center> 

<?php } ?> 
+0

남자가 작동하지 않습니다. – Brian

+0

지금 확인하십시오. 누락 된 중괄호가 수정되었습니다. –

+0

도움 주셔서 감사합니다. – Brian