0

I know this question keeps getting asked, but as far as i can see its just a syntax error and I cant see it. The code is as follows

on index.php:

    <?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE); ?>

<? require($_SERVER["DOCUMENT_ROOT"] . '/WestAncroftSettings.php' ); ?>


<?php include("$ACCESS_PATH" . "/WestAncroft2/Pages/Main/Main.php");?>

and on WestAncroftSettings.php:

<?php $ACCESS_PATH = 'http://' . $_SERVER['HTTP_HOST'].'/WestAncroft2'; ?>

<?php $IMAGE_PATH = 'http://' . $_SERVER['HTTP_HOST'].'/WestAncroft2/images'; ?>

and on Main.php:

<? require($_SERVER[DOCUMENT_ROOT] . '/WestAncroftSettings.php' ); ?>

If you want the rest of the content on the pages just ask.

4

3 回答 3

1

此行的第二个示例缺少引号并同意 Prisoner - 检查短标签设置。建议您使用长标签名称,以防您将来更改服务器

<?php require($_SERVER["DOCUMENT_ROOT"] . '/WestAncroftSettings.php' ); ?>
于 2013-06-12T13:30:27.213 回答
0

You can use short form (<? ?>) of PHP's open tag by enabling the "short_open_tag" to 1 in php.ini file. After change, keep in mind to restart the Apache server.

Then you can use (<? ?>) and (<?php ?>) both in your project.

But bear in mind that If you want to use PHP in combination with XML, you can disable this option in order to use <?xml ?> inline. Otherwise, you can print it with PHP, for example: <?php echo '<?xml version="1.0"?>'; ?>.

于 2013-06-12T13:56:49.523 回答
0

这确实是一个错字

<? require($_SERVER["DOCUMENT_ROOT"] . '/WestAncroftSettings.php' ); ?>

应该

<?php require($_SERVER["DOCUMENT_ROOT"] . '/WestAncroftSettings.php' ); ?>

稍后在您的代码中,您再次使用同一行,<?php并且缺少引号DOCUMENT_ROOT

于 2013-06-12T13:30:36.383 回答