나는이 페이지 (video.php), 나는 다음과 같은 오류 얻을 실행하려고 중간에 "예상치 못한 $ 끝"PHP : 파일
이Parse error: syntax error, unexpected $end in /base/path/masked/inc/functions.php on line 37
이상한 일이다 "functions.php "37 개 이상의 라인이 있습니다 ... 왜 파일의 끝을 감지합니까? do not do 각 함수는 단 하나의 명령문 (print 문)이기 때문에 괄호 나 괄호가 누락되었습니다.
문제를 해결하기 위해 여러 가지 작업을 수행했습니다. 함수 정의에서 print_head() 및 print_foot()에 대한 명령문을 제거하면 오류가 사라집니다 (나머지 페이지는 정상적으로 작동 함). 함수 중 하나에서 명령문을 제거하면 다른 행에서 같은 오류가 발생합니다. 페이지에서 함수 정의를 이동하면 동일한 오류가 발생합니다. 나는 심지어 print 서술문의 일부를 제거하려고했지만, 여전히 같은 오류가 발생한다.
편집 :
'videos/transfer/playlist'는 get_vids()가로드되는 예제 파일입니다. 그것은 짝수 라인의 플랫 txt 파일입니다. 홀수 라인은 비디오 파일의 이름이고 짝수 라인은 위 파일과 함께 사용되는 타이틀입니다. get_vids()가 예상대로 작동하는지 테스트했습니다.
편집 :
가 여기에 내가 명령 줄에서 모든 것을 실행하려고하면 내가 무엇을 얻을 :
video.php :
<?php
include('inc/functions.php');
$type=$_GET['type'];
if($type == '') {
$type = 'transfer';
}
$vidno = $_GET['vid'];
if($vidno == '') {
$vidno = 1;
}
$vidindex = $vidno - 1;
$videos = get_vids($type);
$filename = $videos[$vidindex]['file'];
$title = $videos[$vidindex]['title'];
$basedir = "videos/$type";
$vidfile = "$basedir/$filename";
if($vidfile != '') {
$extra = '<script src="/flowplayer/flowplayer-3.1.4.min.js"></script>';
print_head($title, $extra);
print <<<ENDHTML
<p>
<a
href='$vidfile'
style="display:block;width:640px;height:498px;"
id="player"
></a>
</p>
<p id="contlink" style="display:none">
<a href="done.php?type=$type&vid=$vidno">Click Here to continue</a>
</p>
<script language="JavaScript">
flowplayer(
"player",
"/flowplayer/flowplayer-3.1.5.swf",
{
clip: {
onFinish: function(){
//window.location = "done.php";
//alert('done!');
document.getElementById('contlink').style.display = "block";
}
},
plugins: {
controls: {
play:true,
volume:true,
mute:true,
time:true,
stop:true,
fullscreen:true,
scrubber:false
}
}
}
);
</script>
ENDHTML;
print_foot();
} else {
print_head('OOPS!');
print <<<ENDERROR
<h1>OOPS!</h1>
<p>
It looks like there's no video here. <a onclick="history.go(-1);return false;" href="#">Go back</a> and try again.
</p>
ENDERROR;
print_foot();
}
?>
INC 여기
$ php -l video.php
No syntax errors detected in video.php
$ php video.php
Parse error: syntax error, unexpected $end in /home/nova20/http-dir/orientation/inc/functions.php on line 37
$ php -l inc/functions.php
Parse error: syntax error, unexpected $end in inc/functions.php on line 37
Errors parsing inc/functions.php
내 코드입니다 /functions.php (여기서 은라고 생각합니다) :
,210<?php
function get_vids($type) {
$base = "videos/$type";
$playlist = "$base/playlist";
$vidinfo = file($playlist);
$videos = array();
for($i = 0; $i < count($vidinfo); $i += 2) {
$filename = trim($vidinfo[$i]);
$title = trim($vidinfo[$i+1]);
if($filename != '') {
$index = $i/2;
$video['file'] = $filename;
$video['title'] = $title;
$videos[$index] = $video;
}
}
return($videos);
}
function print_head($title, $extra = '') {
print <<<ENDHEAD
<html>
<head>
<title>$title</title>
$extra
</head>
<body>
ENDHEAD;
}
function print_foot() {
print <<<ENDFOOT
</body>
</html>
ENDFOOT;
}
?>
비디오/전송/재생 목록
1.flv
Introduction
2.flv
Why am I doing this?
3.flv
What can I access with RAIN?
4.flv
How do I access my RAIN Account?
5.flv
How do I Check my registration status?
6.flv
Evaluating transfer credit
7.flv
Transferable degrees
8.flv
Physical Education and History
9.flv
Regents exemptions
10.flv
Academic status
11.flv
How to find my academic advisor?
12.flv
Is Financial Aid available?
13.flv
How do I check my financial aid status?
14.flv
How do I transfer my hope scholarship?
15.flv
Payment information
16.flv
Student Services (Part 1)
17.flv
Student Services (Part 2)
18.flv
Student Services (Part 3)
19.flv
Campus Bookstore
20.flv
Where can I eat on Campus?
21.flv
Where can I live on Campus?
22.flv
How do I register for Parking?
23.flv
Still Have questions?
이 코드의 형식이 사용중인 형식과 동일합니까? – thetaiko
서식을 복사하여 붙여 넣습니다. "비디오/전송/재생 목록"을 질문 설명에 추가하고 있습니다. –