1

示例: 空白 由于我在标题中使用了一些 php,因此呈现了此空白。

我怎样才能摆脱这个空白?

生成空格的代码:

<?php
global $domein;
global $domeinnaam;
global $huidigDomein;
global $get;

$domeinnaam = str_replace('www.', '', $_SERVER['SERVER_NAME']);
$domein = str_replace('.nl', '', $domeinnaam);

include('ond/inc/php/meta.php');
if(!isset($_GET['ond']))
    $_GET['ond'] = 'home';
$pagina = $_GET['ond'];

$get = new Get();
$websites = $get->alleWebsites();
$domeinen = $get->huidigDomein($domein);
$huidigDomein = $domeinen[0]->id;
showMeta($websites, $domeinen);
?>

元文件

  <?php
require_once 'php/db.php';
require_once 'php/db_get.php';
require_once 'php/db_insert.php';
require_once 'php/db_delete.php';
require_once 'php/db_update.php';
require_once 'php/form.php';
require_once 'php/proces.php';
require_once 'php/paginas.php';
require_once 'php/phpmailer.php';
require_once 'php/uploader.php';
require_once 'php/static.php';
require_once 'php/admin.php';
require_once "fckeditor/fckeditor.php"; 
include('ond/inc/php/data.php');


function showMeta($websites, $domeinen)
{
        $rubriek = null;
        $page = null;
        $domein = $domeinen[0]->domein;
        $domeinnaam = $domeinen[0]->domein . '.nl';
        $query = "SELECT * FROM paginas AS p INNER JOIN domeinen AS d ON p.domein = d.id WHERE d.domein = '$domein' AND p.titel = 'Home'";
        $result = mysql_query($query);
        while($row = mysql_fetch_object($result))
            $content = $row->content; 


        if(isset($_GET['id']) && $_GET['ond'] == 'overzicht')
        {
            $id = $_GET['id'];
            $query = "SELECT * FROM rubrieken WHERE id = '$id'";
            $result = mysql_query($query);
            $row = mysql_fetch_object($result);
            $rubriek = 'Overzicht '. ucfirst($row->titel); 
        }
        else
        {
            if(isset($_GET['page']))
            {
                $page = ' - ';
                $page .= urldecode($_GET['page']);
            }

            $pagina = strtolower($_GET['ond']);
            if($pagina == 'home')
                $intro = 'Welkom';
            elseif($pagina == 'aankondiging')
                $intro = 'Nieuws en aankondigingen';
            else
                $intro = ucfirst($pagina);
        }

        if ($websites)
        { 
                $keywords = ucfirst($domeinnaam).', '.ucfirst($domein).', DorpeninDrenthe.nl, Meppel, Bed and Breakfast, Bed & Breakfast, Bed en breakfast, Dagattractie, Dagattracties, Bungalows, Bungalow, Hotels, Hotel, Appartementen, Appartement, Stacaravans, Stacaravan, Chalets, Chalet, Campings, Camping, Galeries, Galerie, Bedrijven, Bedrijf, Restaurants, Restaurant,';
                foreach ($websites as $website)
                { 
                        $url = str_replace("http://www.", " ", $website->url);  
                        $keywords .= strtolower($url);
                        $keywords .= ', ';
                } 

        }

        echo '<meta http-equiv="keywords" content="'.$keywords.'"/>';
        echo '<meta http-equiv="description" content="'.strip_tags(html_entity_decode($content)) .$keywords.'" />';
        echo '<meta name="Author" content="ONDReclame.nl - Meppel - J.M. Suos" />';
        echo '<meta name="Revisit-After" content="1 days" />';
        echo '<meta name="robots" content="index,follow" />';
        echo '<meta name="Title" content="'.ucfirst($domeinnaam). ' - Dorpen in Drenthe - ' . $intro . $rubriek . ' in ' . ucfirst($domein). $page .'"/>';
        echo '<title>'.ucfirst($domeinnaam). ' - Dorpen in Drenthe - ' . $intro . $rubriek . ' in ' . ucfirst($domein) . $page .' </title>';

}
4

2 回答 2

0

如果您至少使用php5 ,这可能会有所帮助:

php_strip_whitespace 函数

于 2012-07-11T14:23:34.713 回答
0

似乎每个包含的文件都给你一个EOL

尝试在所有 php 文件中EOL最后删除?>或完全删除。?>

于 2012-07-11T14:26:36.023 回答