0

这可能有一个明显的答案,但我是 PHP 世界的新手。

所以我$dbpages = fetchAllPagesD($path."/");在我的 UserCake 的 PHP 代码中有它在页面上显示相关路径,在任何内容之前。

我根本不希望它显示任何东西..有什么想法吗?

我讨厌像这样丢掉我所有的代码,但这将有助于找到答案:

<?php
/*
UserCake Version: 2.0.2
http://usercake.com
*/
$root=str_replace('\\','/',$_SERVER['DOCUMENT_ROOT']);
require_once("models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}
$path="";
if(isset($_GET['path'])) $path=$_GET['path'];

$script=dirname($_SERVER['PHP_SELF']);
$baspth=$path;
$dir = glob($root.$path."/*" ,GLOB_ONLYDIR);


$pages = getPageFiles($root.$path); //Retrieve list of pages in root usercake folder
$dbpages = fetchAllPages(); //Retrieve list of pages in pages table
$creations = array();
$deletions = array();

//Check if any pages exist which are not in DB
if (count($pages) > 0)
foreach ($pages as $page){
    if(!isset($dbpages[$page])){
        $creations[] = $page;   
    }
}

//Enter new pages in DB if found
if (count($creations) > 0) {
    createPages($creations) ;
}

if (count($dbpages) > 0){
    //Check if DB contains pages that don't exist
    foreach ($dbpages as $page){
        if(!isset($pages[$page['page']])){
            $deletions[] = $page['id']; 
        }
    }
}

//Delete pages from DB if not found
if (count($deletions) > 0) {
    deletePages($deletions);
}

//Update DB pages
$dbpages = fetchAllPagesD($path."/");

?>







<!DOCTYPE html>
<head>
    <!-- Page data -->
    <title>ClarkeWing.com - My ClarkeWing.com ID - Administration</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=1020">
    <meta name="robots" content="noindex">
    <meta name="author" content="Hugo Clarke-Wing">

    <!-- Mapping -->
    <link rel="home" href="http://www.clarkewing.com/">
    <link rel="index" href="http://www.clarkewing.com/sitemap/">

    <!-- CSS links -->
    <link type="text/css" rel="stylesheet" href="/media/global/light_template/light_template.css" />
    <link type="text/css" rel="stylesheet" href="/media/global/nav/navigation.css" />
    <link type="text/css" rel="stylesheet" href="/media/global/footer/footer.css" />
    <link type="text/css" rel="stylesheet" href="/secure/models/css/admin_pages.css" />
    <link type="text/css" rel="stylesheet" href="/secure/models/css/secure-header.css" />
    <link type="text/css" rel="stylesheet" href="/media/global/fonts/MyriadPro-Regular.css" />

    <!-- JS links -->
    <script type="text/javascript" src="/media/global/jquery.js"></script>
    <script type="text/javascript" src="/media/global/placeholderfix.js"></script>

    <!-- Analytics link -->
    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', '***********', 'clarkewing.com');
    ga('send', 'pageview');
    </script>
</head>


<body>

    <!-- HEADER -->
    <nav id="globalheader" class="secure">
<?php
$path_nav = $_SERVER['DOCUMENT_ROOT'];
$path_nav .= "/media/global/nav/navigation.php";
include($path_nav);
?>
    </nav>
    <!-- /HEADER -->


    <!-- - - - - - - - - - - - - - - - - - - - - - - CONTENT - - - - - - - - - - - - - - - - - - - - - - - -->
    <div id="main-wrapper">
        <div id="secure-header" class="admin">
<?php
include("secure-header.php");
?>
        </div>

        <div class="content">
            <div id="results">
            <?php echo resultBlock($errors,$successes); ?>
            </div>

            <div id="directories">
                <h2>Directories</h2>
                <?php
                //echo"<br>realpth:".$realpth." baspth:".$baspth." dirname (baspth):".dirname($baspth)."<br>";
                ?>
                <ul>
                    <?php
                    if($path!="/" )
                    {
                        $top=dirname($baspth);
                        if($top=="\\")$top="";
                        echo "<li><a href='".$_SERVER['PHP_SELF']."?path=".$top."'>../</a></li>";
                    }
                    if (count($dir) > 0)
                    foreach ($dir as $directory){
                    $directory =str_replace($root,'',$directory);
                        echo "<li><a href='".$_SERVER['PHP_SELF']."?path=".$directory."'>".basename($directory)."</a></li>";
                    }
                    ?>
                </ul>
            </div>

            <div id="pages">
                <?php
                echo "
                <h2>Current Directory: ".$baspth."/</h2>";
                ?>
                <table>
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Page</th>
                            <th>Access</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        //Display list of pages
                        if (count($dbpages) > 0)
                        foreach ($dbpages as $page){
                            echo "
                            <tr>
                            <td>
                            ".$page['id']."
                            </td>
                            <td>
                            <a href ='admin_page.php?id=".$page['id']."'>".basename($page['page'])."</a>
                            </td>
                            <td>";
                            //Show public/private setting of page
                            if($page['private'] == 0){
                                echo "Public";
                            }
                            else {
                                echo "Private"; 
                            }
                            echo "
                            </td>
                            </tr>";
                        }
                        else echo "
                            <tr>
                                <td>&nbsp;</td>
                                <td>No PHP pages in this directory</td>
                                <td></td>
                            </tr>";
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <!-- - - - - - - - - - - - - - - - - - - - - - - /CONTENT - - - - - - - - - - - - - - - - - - - - - - - -->


    <!-- FOOTER -->
<?php
$path_footer = $_SERVER['DOCUMENT_ROOT'];
$path_footer .= "/media/global/footer/footer.php";
include($path_footer);
?>
    <!-- /FOOTER -->

</body>
</html>
4

1 回答 1

1

您的路径可以在任何地方打印,从函数调用、包含等。

您需要调试自己的代码并找到它的打印位置,删除部分代码并重新加载您的页面,直到它不再显示,然后您就会知道是哪个代码打印了它。

如果无法访问您的整个代码,包括您的所有功能和包含,我们就找不到它,但是对于这个问题,它真的没有必要,您只需要学习调试您的代码。

于 2013-07-16T15:50:48.687 回答