2013-10-31 74 views
2

這裏是我的代碼PHP顯示爲HTML

<? 
include_once($_SERVER['DOCUMENT_ROOT'] . "/inc/path.php"); 

include $_SERVER['DOCUMENT_ROOT'] . "/inc/category_functions.php"; 

if (!$go4th) { 
    die(); 
} 

$content_links = content_links('tbl_content', 'content_id', 'title', ''); 

$content_id = 1; // home page content ID 
$content = get_record('tbl_content', 'content_id', $content_id); 
if ($content->show_title == 1) { 
    $title = '<div class="content-title">' . $content->title . '</div>'; 
} 

if ($content->page_title) { $page_title = $content->page_title; } 
else if ($content->title) { $page_title = $content->title; } 

if ($content->meta_keywords) { $meta_keywords = $content->meta_keywords; } 
else       { $meta_keywords = $META_KEYWORDS; } 

if ($content->meta_description) { $meta_description = $content->meta_description; } 
else       { $meta_description = $META_DESCRIPTION; } 

// display the template 
include $_SERVER['DOCUMENT_ROOT'] . "/inc/inside/email_list_popup.php"; //email list popup, first15 promo, etc 
include $_SERVER['DOCUMENT_ROOT'] . "/template/" . $SITE_THEME . "/index.php"; 
?> 

這是當我加載它在我的WAMP的服務器上

SHOW_TITLE什麼是顯示== 1){$標題= ' ' 。 $ content-> title。 ' '; } if($ content-> page_title){$ page_title = $ content-> page_title; } else if($ content-> title){$ page_title = $ content-> title; } if($ content-> meta_keywords){$ meta_keywords = $ content-> meta_keywords; }其他{$ meta_keywords = $ META_KEYWORDS; } if($ content-> meta_description){$ meta_description = $ content-> meta_description; } else {$ meta_description = $ META_DESCRIPTION; } //顯示模板包括$ _SERVER ['DOCUMENT_ROOT']。 「/inc/inside/email_list_popup.php」; //電子郵件列表彈出窗口,first15 promo等包括$ _SERVER ['DOCUMENT_ROOT']。 「/ template /」。 $ SITE_THEME。 「的index.php」; ?>

這就好像它正在將$ content->中的>視爲HTML的右括號。

這是我的.htaccess

Options -MultiViews 
RewriteEngine on 
RewriteRule ^category/[0-9A-Za-z\-]+/c?([0-9]+)?m?([0-9]+)?p?([g0-9]+)?a?(1)?n?(1)?s?(1)?/?$ /category.php?category_id=$1&manufacturer_id=$2&page=$3&all=$4&new=$5&sale=$6 
RewriteRule ^manufacturer/[0-9A-Za-z\-]+/([0-9]+)/?([0-9]+)?/?$ /category.php?manufacturer_id=$1&category_id=$2 
RewriteRule ^item/[0-9A-Za-z\-]+/([0-9]+)/?p?-?([g0-9]+)?c?([0-9]+)?m?([0-9]+)?/?$ /item.php?item_id=$1&page=$2&category_id=$3&manufacturer_id=$4 
RewriteRule ^content/[0-9A-Za-z\-]+/([0-9]+)/?$ /content.php?content_id=$1 
RewriteRule ^sale/?$ /category.php?sale=1 
RewriteRule ^new/?$ /category.php?new=1 
RewriteRule ^all/?$ /category.php?all=1 
RewriteRule ^all_manufacturers/?$ /category.php?all_mfg=1 

<FilesMatch "\.(ttf|eot|svg|woff)$"> 
<IfModule mod_headers.c> 
Header set Access-Control-Allow-Origin "*" 
</IfModule> 
</FilesMatch> 

<IfModule mod_php5.c> 
    AddType application/x-httpd-php .php .phtml .php3 
    AddType application/x-httpd-php-source .phps 
</IfModule> 
+4

您可能在您的PHP.ini中禁用了'short_open_tag'。 –

+2

將'<?'更改爲'<?php'? – Volvox

+1

可能的短標籤問題? http://stackoverflow.com/questions/4645898/how-to-set-short-tag-in-php –

回答

6

看起來像一個PHP標籤錯誤。

解決方案:

  • 變化<?<?php

  • 改變你的php.ini選項short_open_tag=On

希望它有助於

+0

在將'short_open_tag'選項更改爲'On'之前,請考慮以下後果:http://stackoverflow.com/問題/ 200640 /是的PHP短標籤可接受使用的 –