Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 动态站点标题_Php_Dynamic_Title - Fatal编程技术网

Php 动态站点标题

Php 动态站点标题,php,dynamic,title,Php,Dynamic,Title,我创建了这个动态站点。它几乎可以正常工作,但我有一个问题。 如何为每个页面(在html标记中)设置虚拟标题。 我希望你明白我的意思。 看看我的index.php <html> <?php include_once 'config.php'; include_once 'includes/mysqlconnect.php'; $url_slash=$_SERVER['REQUEST_URI']; $url= rtrim($url_slash

我创建了这个动态站点。它几乎可以正常工作,但我有一个问题。 如何为每个页面(在html标记中)设置虚拟标题。 我希望你明白我的意思。 看看我的index.php

<html>
    <?php
    include_once 'config.php';
    include_once 'includes/mysqlconnect.php';
    $url_slash=$_SERVER['REQUEST_URI'];
    $url= rtrim($url_slash, '/');
    //$url = basename($url);
    ?>
    <head>
        <meta charset="UTF-8">
        <title>KasCraft | *********</title> //Here I need a variable or some other to display the title for each site
        <link rel="stylesheet" type="text/css" href="<?php echo $domain;?>themes/reset.css">
        <link rel="stylesheet" type="text/css" href="<?php echo $domain;?>themes/<?php echo $theme;?>.css">
    </head>
    <body class="body">
        <div class="container-all">
            <?php include_once 'includes/header.php';?>
            <div class="container">
                <?php include_once 'includes/navigationbar.php';?>
                <?php include_once 'includes/rightsidebar.php';?>
                <div class="content"><?php

                if ($url==''){

                    include_once "sites/home.php";
                }
                elseif (file_exists("sites/$url.php") && is_readable('/var/www/html/sites/'.$url.'.php')){
                    include_once '/var/www/html/sites/'.$url.'.php';

                }

                else {
                    include_once 'sites/404.php';

                }


                ?></div>
                <?php include_once 'includes/footer.php';?>
            </div>
        </div>
    </body>
</html>

Kaskraft |********//这里我需要一个变量或其他变量来显示每个站点的标题

任何人都可以帮助我。

不要再包括从用户那里得到的东西。有人可能会将“../../../etc/passwd”之类的内容作为
$url
注入。甚至更糟糕的是,可能会将一个名为something.jpg的php文件上载到您的服务器(例如,通过一些Web应用程序),然后包含此恶意代码。再次声明:不要包含从外部数据源获取的文件。1。它不是外部文件。2.我用mydomain.com/../../../../../etc/virc测试了这一点,文件dosent显示了这一点。但是你能回答我的问题吗???$url来自请求URI,所以它是外部的。