得到500内部服务器错误? [关闭]

Here is the php code that created the problem

<?php
$link = $_SERVER['PHP_SELF'];
$link_array = explode('/',$link);
$last_part = end($link_array);
if($last_part == "funnyprank01.php"||$last_part == "funnyprank02.php"||$last_part == "funnyprank03.php"||$last_part == "funnyprank04.php")
{
<meta property="og:image"            content="http://i1.ytimg.com/vi/3uRpVGkVhVI/hqdefault.jpg">
<meta property="og:image:type"       content="image/jpg">
}
else
{
<meta property="og:image"            content="http://www.8mags.com/images/youtubeimage.png">
<meta property="og:image:type"       content="image/png">
}
?>

before adding this code everything was working fine. The name of file containing this code is header.php

<?php
$link = $_SERVER['PHP_SELF'];
$link_array = explode('/',$link);
$last_part = end($link_array);
if($last_part == "funnyprank01.php"||$last_part == "funnyprank02.php"||$last_part ==     "funnyprank03.php"||$last_part == "funnyprank04.php")
{
?>
<meta property="og:image"            content="http://i1.ytimg.com/vi/3uRpVGkVhVI/hqdefault.jpg">
<meta property="og:image:type"       content="image/jpg">
<?php
}
else
{
?>
<meta property="og:image"            content="http://www.8mags.com/images/youtubeimage.png">
<meta property="og:image:type"       content="image/png">
<?php
}
?>

If it STILL returns a 500 error, refer to my original answer

Don't forget to close php tags.

<?php
$link = $_SERVER['PHP_SELF'];
$link_array = explode('/',$link);
$last_part = end($link_array);
if($last_part == "funnyprank01.php"||$last_part == "funnyprank02.php"||$last_part == "funnyprank03.php"||$last_part == "funnyprank04.php"):?>
<meta property="og:image"            content="http://i1.ytimg.com/vi/3uRpVGkVhVI/hqdefault.jpg">
<meta property="og:image:type"       content="image/jpg">
<?php else:?>
<meta property="og:image"            content="http://www.8mags.com/images/youtubeimage.png">
<meta property="og:image:type"       content="image/png">
<?php endif?>

Change it to:

<?php
$link = $_SERVER['PHP_SELF'];
$link_array = explode('/',$link);
$last_part = end($link_array);
if($last_part == "funnyprank01.php"||$last_part == "funnyprank02.php"||$last_part == "funnyprank03.php"||$last_part == "funnyprank04.php")
{ ?>
<meta property="og:image"            content="http://i1.ytimg.com/vi/3uRpVGkVhVI/hqdefault.jpg">
<meta property="og:image:type"       content="image/jpg">

<?php }
else
{ ?>
<meta property="og:image"            content="http://www.8mags.com/images/youtubeimage.png">
<meta property="og:image:type"       content="image/png">
<?php } ?>