Форум программистов, компьютерный форум, киберфорум
PHP для начинающих
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.61/74: Рейтинг темы: голосов - 74, средняя оценка - 4.61
 Аватар для alcosport
2 / 2 / 0
Регистрация: 11.07.2011
Сообщений: 16

Parse error: syntax error, unexpected $end

11.07.2011, 16:04. Показов 13873. Ответов 5
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Прошу помогите! В чем тут проблема, и как её исправить?
Parse error: syntax error, unexpected $end in /home/public_html/short.php on line 83
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
// Start YOURLS engine
require_once( dirname(__FILE__).'/includes/load.php' );
?>
<html lang="ru"> 
<head> 
    <title>сокращалка &there4;</title> 
    <meta charset="utf-8" /> 
    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <link rel="stylesheet" href="/css/main.css" type="text/css" /> 
 
    <!--[if IE]>
        <script src="/js/html5.js"></script><![endif]--> 
    
    <!--[if lte IE 7]>
        <link rel="stylesheet" type="text/css" media="all" href="/css/ie.css"/>
        <script src="/js/IE8.js" type="text/javascript"></script><![endif]--> 
        
    <!--[if lt IE 7]>
        <link rel="stylesheet" type="text/css" media="all" href="/css/ie6.css"/><![endif]--> 
    <script src="/js/jquery-1.4.3.min.js" type="text/javascript"></script>
    <script src="/js/jquery.formalize.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(function() { $('label[title]').qtip(); });
    </script>
 
</head> 
 
<body id="index" class="home"> 
    
    <section id="content" class="body"> 
        
        <ol id="posts-list" class="hfeed"> 
            <li><article class="hentry">    
                <header> 
                    <h2 class="entry-title">сокращалка</h2> 
                </header> 
                
                <div class="entry-content"> 
                    <?php
                    
                    // Part to be executed if FORM has been submitted
                    if ( isset($_REQUEST['url']) ) {
                    
                        $url     = yourls_sanitize_url( $_REQUEST['url'] );
                        $keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;
                        $title   = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;
                        $return  = yourls_add_new_link( $url, $keyword, $title );
                        
                        $shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';
                        $message  = isset( $return['message'] ) ? $return['message'] : '';
                        $title    = isset( $return['title'] ) ? $return['title'] : '';
                    
                    echo <<<RESULT
                    <p>$message</p> 
                    <div class="shorted">
                    <p>Оригинальная ссылка: <a href="$url">$url</a></p>
                    <p>Короткая ссылка: <a href="$shorturl">$shorturl</a></p>
                    <p>Статистика: <a href="$shorturl+">$shorturl+</a></p>
                    </div>
                    RESULT;
                    } else {
                    $site = YOURLS_SITE;
                    echo <<<HTML
                    <p>Введите новую ссылку для укорачивания<p>
                    <div class="shorted">
                    <form method="post" action="">
                    <p><label for="url" title="Вставьте сюда длиную ссылку">Длинная ссылка (обязательно):</label> <input type="text" id="url" class="right" name="url" /></p>
                    <p><label for="keyword" title="A keyword replaces the default short string">Выборочное слово:</label> <input type="text" id="keyword" class="right" name="keyword" /></p>
                    <p><input type="submit" value="сократить" /></p>
                    </form>
                    HTML;
                    }
                    ?>
                    
                </div><!-- /.entry-content --> 
            </article></li> 
        </ol><!-- /#posts-list --> 
        
    </section><!-- /#content --> 
 
</body>
</html>
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
11.07.2011, 16:04
Ответы с готовыми решениями:

Ошибка: Parse error: syntax error, unexpected end of file in
Данный код синтаксическую ошибку, как я понимаю, на последней строке. Parse error: syntax error, unexpected end of file in...

Ошибка в форме обратной связи: Parse error: syntax error, unexpected $end
Всем здрасте! сделал форму обратной связь: &lt;form action=&quot;fbsend.php&quot; method=&quot;post&quot;&gt; &lt;div id=&quot;fb&quot;&gt; &lt;label&gt;Ваше имя&lt;b...

Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION)
Выскакивает такая ошибка &quot;Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) in...

5
191 / 191 / 31
Регистрация: 04.10.2010
Сообщений: 505
11.07.2011, 16:48
Перед закрывающим идентификатором не должно быть ни каких символов.
т.е.
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
// Start YOURLS engine
require_once( dirname(__FILE__).'/includes/load.php' );
?>
<html lang="ru"> 
<head> 
        <title>сокращалка &there4;</title> 
        <meta charset="utf-8" /> 
        <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <link rel="stylesheet" href="/css/main.css" type="text/css" /> 
 
        <!--[if IE]>
                <script src="/js/html5.js"></script><![endif]--> 
        
        <!--[if lte IE 7]>
                <link rel="stylesheet" type="text/css" media="all" href="/css/ie.css"/>
                <script src="/js/IE8.js" type="text/javascript"></script><![endif]--> 
                
        <!--[if lt IE 7]>
                <link rel="stylesheet" type="text/css" media="all" href="/css/ie6.css"/><![endif]--> 
    <script src="/js/jquery-1.4.3.min.js" type="text/javascript"></script>
    <script src="/js/jquery.formalize.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(function() { $('label[title]').qtip(); });
    </script>
 
</head> 
 
<body id="index" class="home"> 
        
        <section id="content" class="body"> 
                
                <ol id="posts-list" class="hfeed"> 
                        <li><article class="hentry">    
                                <header> 
                                        <h2 class="entry-title">сокращалка</h2> 
                                </header> 
                                
                                <div class="entry-content"> 
                                        <?php
                    
                    // Part to be executed if FORM has been submitted
                    if ( isset($_REQUEST['url']) ) {
                    
                        $url     = yourls_sanitize_url( $_REQUEST['url'] );
                        $keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;
                        $title   = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;
                        $return  = yourls_add_new_link( $url, $keyword, $title );
                        
                        $shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';
                        $message  = isset( $return['message'] ) ? $return['message'] : '';
                        $title    = isset( $return['title'] ) ? $return['title'] : '';
                    
                    echo <<<RESULT
                    <p>$message</p> 
                    <div class="shorted">
                    <p>Оригинальная ссылка: <a href="$url">$url</a></p>
                    <p>Короткая ссылка: <a href="$shorturl">$shorturl</a></p>
                    <p>Статистика: <a href="$shorturl+">$shorturl+</a></p>
                    </div>
RESULT;
                    } else {
                    $site = YOURLS_SITE;
                    echo <<<HTML
                    <p>Введите новую ссылку для укорачивания<p>
                    <div class="shorted">
                    <form method="post" action="">
                    <p><label for="url" title="Вставьте сюда длиную ссылку">Длинная ссылка (обязательно):</label> <input type="text" id="url" class="right" name="url" /></p>
                    <p><label for="keyword" title="A keyword replaces the default short string">Выборочное слово:</label> <input type="text" id="keyword" class="right" name="keyword" /></p>
                    <p><input type="submit" value="сократить" /></p>
                    </form>
HTML;
                    }
                    ?>
                    
                                </div><!-- /.entry-content --> 
                        </article></li> 
                </ol><!-- /#posts-list --> 
                
        </section><!-- /#content --> 
 
</body>
</html>
1
 Аватар для alcosport
2 / 2 / 0
Регистрация: 11.07.2011
Сообщений: 16
11.07.2011, 16:56  [ТС]
Цитата Сообщение от hellpass Посмотреть сообщение
Перед закрывающим идентификатором не должно быть ни каких символов.
Спасибо, всё заработало!
0
 Аватар для alcosport
2 / 2 / 0
Регистрация: 11.07.2011
Сообщений: 16
14.07.2011, 03:20  [ТС]
Внес кое-какие поправки, и опять обращаюсь к вам за помощью. Ошибка где-то в elseif, т.к. его я и добавил.
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
                <?php
                    
                    // Part to be executed if FORM has been submitted
                    if ( isset($_REQUEST['url']) ) {
                    
                        $url     = yourls_sanitize_url( $_REQUEST['url'] );
                        $keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;
                        $title   = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;
                        $return  = yourls_add_new_link( $url, $keyword, $title );
                        
                        $shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';
                        $message  = isset( $return['message'] ) ? $return['message'] : '';
                        $title    = isset( $return['title'] ) ? $return['title'] : '';
                    
                    echo <<<RESULT
                <header>
                    <h2 class="entry-title">$message</h2> 
                </header>
                
                <footer class="post-info"> 
                    <address class="vcard author"> 
                        <img src="/img/post/link.png" class="PostType"/>
                    </address> 
 
                </footer><!-- /.post-info -->
                
                <div class="entry-content">
                    <div id="shorted" style="margin-top:10px;">
                    <p>Оригинальная ссылка: <a href="$url">$url</a></p>
                    <p>Короткая ссылка: <a href="$shorturl">$shorturl</a></p>
                    </div>
                </div><!-- /.entry-content -->
RESULT;
                } elseif {
            $return['message'] != yourls_trim_long_string( $strip_url ).' добавлена в базу';
 
            echo <<<WRONG
                <header>
                    <h2 class="entry-title">$message</h2> 
                </header>
                
                <footer class="post-info"> 
                    <address class="vcard author"> 
                        <img src="/img/post/link.png" class="PostType"/>
                    </address> 
 
                </footer><!-- /.post-info -->
                
                <div class="entry-content">
                    <div id="shorted" style="margin-top:10px;">
                    <p><a href="/short">Попробовать заново</a></p>
                    </div>
                </div><!-- /.entry-content -->
WRONG;
                } else {
                    $site = YOURLS_SITE;
                    
                    echo <<<HTML
                    <header> 
                    <h2 class="entry-title" style="margin-top:-20px;">Введите новую ссылку для укорачивания</h2> 
                </header>
                
                <footer class="post-info"> 
                    <address class="vcard author"> 
                        <img src="/img/post/link.png" class="PostType"/>
                    </address> 
 
                </footer><!-- /.post-info -->
                
                <div class="entry-content">
                    <div id="shorted" style="margin-top:10px;">
                    <form method="post" action="">
                    <p><label for="url">Длинная ссылка<b style="color:red;">*</b>:</label> <div id="urlF"><input type="text" id="url" class="right" name="url" /></div></p>
                    <p><label for="keyword">Выборочное слово:</label> <div id="urlF"><span id="urlP">politov.me/</span><input type="text" maxlength="10" id="keyword" class="right" name="keyword" /></div></p>
                    <p><input type="submit" value="сократить" /></p>
                    </form>
                    </div>
                </div><!-- /.entry-content -->
HTML;
                    }
                    ?>
0
36 / 36 / 9
Регистрация: 13.07.2011
Сообщений: 95
14.07.2011, 09:46
У elseif должно быть условие в скобках как и у if
Читаем тут http://docs.php.net/manual/en/... elseif.php
1
 Аватар для alcosport
2 / 2 / 0
Регистрация: 11.07.2011
Сообщений: 16
14.07.2011, 13:19  [ТС]
Сделал так, что всё заработало, как я и хотел. Если вдруг кому интересно, вставляю код. Это для сокращалки ссылок YOURLS. Всем спасибо за помощь.
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
                    
// Part to be executed if FORM has been submitted
if ( isset($_REQUEST['url']) ) {
                    
    $url     = yourls_sanitize_url( $_REQUEST['url'] );
    $keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;
    $title   = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;
    $return  = yourls_add_new_link( $url, $keyword, $title );
                        
    $shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';
    $message  = isset( $return['message'] ) ? $return['message'] : '';
    $title    = isset( $return['title'] ) ? $return['title'] : '';
                        
    $findme = 'добавлена в базу';
                    
    if ((eregi($findme, $message)) != 0) {
echo <<<RESULT
        <header>
            <h2 class="entry-title">$message</h2> 
        </header>
        <footer class="post-info"> 
            <address class="vcard author"> 
                <img src="/img/post/link.png" class="PostType"/>
            </address> 
        </footer><!-- /.post-info -->
        <div class="entry-content">
            <div id="shorted" style="margin-top:10px;">
                <p>Оригинальная ссылка: <a href="$url">$url</a></p>
                <p>Короткая ссылка: <a href="$shorturl">$shorturl</a></p>
            </div>
        </div><!-- /.entry-content -->
RESULT;
    } else {
echo <<<WRONG
        <header>
            <h2 class="entry-title">$message</h2> 
        </header>
        <footer class="post-info"> 
            <address class="vcard author"> 
                <img src="/img/post/link.png" class="PostType"/>
            </address> 
        </footer><!-- /.post-info -->
        <div class="entry-content">
            <div id="shorted" style="margin-top:10px;">
                <p><a href="/short">Попробовать заново</a></p>
            </div>
        </div><!-- /.entry-content -->
WRONG;
    }
} else {
    $site = YOURLS_SITE;
echo <<<HTML
    <header> 
        <h2 class="entry-title" style="margin-top:-20px;">Введите новую ссылку для укорачивания</h2> 
    </header>
    <footer class="post-info"> 
        <address class="vcard author"> 
            <img src="/img/post/link.png" class="PostType"/>
        </address> 
    </footer><!-- /.post-info -->
    <div class="entry-content">
        <div id="shorted" style="margin-top:10px;">
            <form method="post" action="">
                <p><label for="url">Длинная ссылка<b style="color:red;">*</b>:</label> <div id="urlF"><input type="text" id="url" class="right" name="url" /></div></p>
                <p><label for="keyword">Выборочное слово:</label> <div id="urlF"><span id="urlP">politov.me/</span><input type="text" maxlength="10" id="keyword" class="right" name="keyword" /></div></p>
                <p><input type="submit" value="сократить" /></p>
            </form>
        </div>
    </div><!-- /.entry-content -->
HTML;
}
?>
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
14.07.2011, 13:19
Помогаю со студенческими работами здесь

Parse error: syntax error, unexpected $end in C:\Polygone\sqltest.php on line 85.
Недавно встал на тропу работы с php и mysql. Во время набора одной из учебных программ столкнулся с ошибкой Parse error: syntax error,...

Ошибка - Parse error: syntax error, unexpected $end
При нажатии на ссылку выдает ошибку syntax error, unexpected $end line ....(последняя строчка , m.e &lt;/html&gt;) Несколько раз...

ошибка Parse error: syntax error, unexpected $end
Всем привет, столкнулся с такой ошибкой Parse error: syntax error, unexpected $end , ошибка указывает на закрывающий тег ?&gt;. Спришвал на...

Ошибка Parse error: syntax error, unexpected $end
Приветствую! Выдает ошибку в строчке 231 Parse error: syntax error, unexpected $end Помогите пожалуйста разобраться! Скрытых символов...

Parse error: syntax error, unexpected $end - ошибка в HERE
Здраствуйте... не могу найти ошибку... браузер пишет ошибку в последней линии видимо чтото с синтаксисом HERE но что? Parse error:...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
6
Ответ Создать тему
Новые блоги и статьи
PhpStorm 2025.3: WSL Terminal всегда стартует в ~
and_y87 14.12.2025
PhpStorm 2025. 3: WSL Terminal всегда стартует в ~ (home), игнорируя директорию проекта Симптом: После обновления до PhpStorm 2025. 3 встроенный терминал WSL открывается в домашней директории. . .
Как объединить две одинаковые БД Access с разными данными
VikBal 11.12.2025
Помогите пожалуйста !! Как объединить 2 одинаковые БД Access с разными данными.
Новый ноутбук
volvo 07.12.2025
Всем привет. По скидке в "черную пятницу" взял себе новый ноутбук Lenovo ThinkBook 16 G7 на Амазоне: Ryzen 5 7533HS 64 Gb DDR5 1Tb NVMe 16" Full HD Display Win11 Pro
Музыка, написанная Искусственным Интеллектом
volvo 04.12.2025
Всем привет. Некоторое время назад меня заинтересовало, что уже умеет ИИ в плане написания музыки для песен, и, собственно, исполнения этих самых песен. Стихов у нас много, уже вышли 4 книги, еще 3. . .
От async/await к виртуальным потокам в Python
IndentationError 23.11.2025
Армин Ронахер поставил под сомнение async/ await. Создатель Flask заявляет: цветные функции - провал, виртуальные потоки - решение. Не threading-динозавры, а новое поколение лёгких потоков. Откат?. . .
Поиск "дружественных имён" СОМ портов
Argus19 22.11.2025
Поиск "дружественных имён" СОМ портов На странице: https:/ / norseev. ru/ 2018/ 01/ 04/ comportlist_windows/ нашёл схожую тему. Там приведён код на С++, который показывает только имена СОМ портов, типа,. . .
Сколько Государство потратило денег на меня, обеспечивая инсулином.
Programma_Boinc 20.11.2025
Сколько Государство потратило денег на меня, обеспечивая инсулином. Вот решила сделать интересный приблизительный подсчет, сколько государство потратило на меня денег на покупку инсулинов. . . .
Ломающие изменения в C#.NStar Alpha
Etyuhibosecyu 20.11.2025
Уже можно не только тестировать, но и пользоваться C#. NStar - писать оконные приложения, содержащие надписи, кнопки, текстовые поля и даже изображения, например, моя игра "Три в ряд" написана на этом. . .
Мысли в слух
kumehtar 18.11.2025
Кстати, совсем недавно имел разговор на тему медитаций с людьми. И обнаружил, что они вообще не понимают что такое медитация и зачем она нужна. Самые базовые вещи. Для них это - когда просто люди. . .
Создание Single Page Application на фреймах
krapotkin 16.11.2025
Статья исключительно для начинающих. Подходы оригинальностью не блещут. В век Веб все очень привыкли к дизайну Single-Page-Application . Быстренько разберем подход "на фреймах". Мы делаем одну. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2025, CyberForum.ru