I have an index.php-file, which will echo the string with the returned .html-file prepared by the function which is called in the index.php-file
index.php:
require_once('functions.php');
echo create_page();
functions.php:
function create_page() {
$result = file_get_contents('index.html');
return $result;
}
The problem is that everytime, the html is generated with this functions, I have a gap at the bottom of the page.
If I include several .html-pages into a .html-page with str_replace
, a gap is at the top of every replacement.
If I display the .html-file by double-clicking it, it will be displayed without a gap at the bottom.
What am I doing wrong here?
There ar开发者_JAVA百科e no additional echos in the script.
Check your php files, I bet they contain some new lines / spaces / tabs / other-white psace characters after php closing tag (?>
). The best is to omit this closing tag, then every whitespace from the end of file will be treated as php source (harmless) and will not produce any output.
Ok Here ist the soluton:
Don't allow BOM in your texteditor-settings!
The BOM could not be interpreted from the browser, so he added the gap at the bottom of every file which has BOM enabled...
Hope it helps someone else!
Thank you everyone!
精彩评论