开发者

Unexpected end in PHP script

I really can't find the error. Here is my code:

<开发者_JAVA技巧;?
    // Action: add news
    if( array_key_exists('create_new', @$_POST) )
    {
?>
  ...
<?
        exit();
    }
?>

Before this my problem was in construction: <?=...;?> My web server (Apache) did not understand the syntax so I rewrote the method without it, but now I really can't find a solution.


Add a space before the ? and after the ; here:

$_SERVER['REQUEST_URI'];?>

Replace all <? by <?php


@$_POST should just be $_POST


you should you the alternate if syntax:

<?php
// Action: add news
if( array_key_exists('create_new', @$_POST) ):

?>
...
<?php
  exit();
  endif;
?>

it's also better to use the


You're apparently missing a close brace. I hate to say it, but without the complete code, it's pretty hard for us to tell you where the problem is... so either I think we need to see the complete code, or you'll have to sit down with a decent editor and trace the opening and closing braces.


Although it's a bit odd, if you put a semi-colon after a brace in this kind of scenario, it'll get rid of your errors.

<?
    // Action: add news
    if( array_key_exists('create_new', @$_POST) )
    {
?>
  ...
<?
        exit();
    };
?>

Note the second to last line now has a semi-colon AFTER the brace.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜