PHP. "?>" on top of page
I am creating site with php. On localhost all works well. On my hosting all looks good too, but on top of page i see "?>". In my code these symbols are ab开发者_如何学Gosent.
What is this?
It could be that your code uses short open tags (<?
instead of <?php
) and your hosting provider has short open tags turned off. That would mean, however, that your PHP code is not interpreted at all. It could also mean that your hosting provider doesn't support PHP at all, or only for certain file types.
Take a look into the page's source code to check whether that is the case.
The fact that you see that on top of the page could mean one or more things.
- It seems you have typed in
?>
outside of a php block - You may be using short tags
<?
instead of long<?php
and the host has short tags turned off
Out of these its most likely you have a closing ?>
in your code without a corresponding open <?php
tag
Are you sure yu're seeing ?>
and not something like >>?
?
Otherwise, this smells like a PHP-EndTag which was never opened...check your code.
If you have a empty lines in your sourcefile before the opening <?php
-tag, then those empty lines could get outputted unintenionally. If your script should start with <?php
on top, remove all the empty lines above it.
精彩评论