繁体   English   中英

PHP显示为HTML

[英]PHP Displaying As 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){$ title =''。 $ content-> title。 ''; }如果($ content-> page_title){$ page_title = $ content-> page_title; }否则,如果($ 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; } //显示包含$ _SERVER ['DOCUMENT_ROOT']的模板。 “/inc/inside/email_list_popup.php”; //电子邮件列表弹出窗口,first15促销等,包括$ _SERVER ['DOCUMENT_ROOT']。 “ /模板/”。 $ 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>

看起来像一个php-tag错误。

解决方案:

  • 更改<? <?php

要么

  • 在您的php.ini中更改选项short_open_tag=On

希望能帮助到你

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM