文件存在,但不包含变量作为路径,不是权限问题


File exists but will not include with variable as path, not permission issue

我有一个正在制作的模板,它通过动态包含生成动态内容。问题是,尽管这些包含文件存在(是的,我检查了),但它们不会包含或要求,即使有错误报告也不会抛出错误。下面是相关的代码-请注意,我在相同的基本目录中包含了其他文件,没有问题,即nav.php.

        <div id="main-wrap">
            <div id="main" role="main">
                <section id="header-img">
                     <div id="rotator">
                        <div id="controls">
                            <div id="rotator-next"></div>
                            <div id="rotator-prev"></div>
                        </div>
                        <img src="<?php echo $BD; ?>img/index-header.jpg" width="3416" height="362" alt="">
                    </div>
                    <?php
                        if ($PAGE !== 'step2')
                        {
                            require_once 'inc/form-main.php';
                        }
                    ?>
                </section><!-- /#header-img -->
                <div class="clear"></div>
                <div id="inner-page-content" class="wide locations">
                    <div id="inner-page-inner">
                        <?php
                            $path = "inc/pages/$service/$location.php";
                            echo $path . '<br>';
                            if (file_exists($path))
                            {
                                require_once "inc/pages/$service/$location.php";
                                echo '<pre>'; print_r(error_get_last()); echo '</pre>';
                            }
                            else
                            {
                                require_once 'inc/404w.php';
                            }

请注意,我已经尝试使用一个连接字符串,也尝试传递一个变量来要求$path。即使有错误报告,也不会抛出工作和错误。当我输出$path时,它显示了正确的路径。我检查了相关文件甚至目录的权限,都设置正确

是否与PHP include_path变量有关?页面是否可能试图要求与当前工作目录相关的文件,而不是从站点根目录?