不知道如何使用Swoole动态加载页面

问题描述

你好,开发者朋友。

我正在尝试使旧的网站可以使用肿胀的http服务器,但是我正在堆叠。 我遵循入门教程,但找不到前进的路。

<?php
use Swoole\Http\Server;
use Swoole\Http\Request;
use Swoole\Http\Response;

$server = new Swoole\HTTP\Server("127.0.0.1",9501);

$server->on("start",function (Server $server) {
    echo "Swoole http server is started at http://127.0.0.1:9501\n";
});

$server->on("request",function (Request $request,Response $response) {
    $response->header("Content-Type","text/plain");
    $response->end("Hello World\n");
});

$server->start();

现在,我想根据URL动态加载我的内容(例如我用于apache服务器的内容),但是找不到如何执行此操作。 这是我的旧索引文件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="shortcut icon" href="images/logo.png" type="image/x-icon">
    <link rel='stylesheet' type='text/css' href='css/bootstrap.min.css' />
    <link rel='stylesheet' type='text/css' href='css/jquery-ui.css' />
    <link rel='stylesheet' type='text/css' href='css/font-awesome.min.css' />
    <link rel='stylesheet' type='text/css' href='css/bootstrap-select.min.css' />
    <link rel='stylesheet' type='text/css' href='css/select2.css' />
    <link rel='stylesheet' type='text/css' href='css/admin.css' />
    <script src='js/jquery-3.1.1.min.js'></script>
    <script src="js/fusioncharts.js"></script>
    <script src="js/fusioncharts.charts.js"></script>
    <script src="js/fusioncharts.theme.fusion.js"></script>
</head>
<body >
    <?php
        if(in_array($_GET['_page'],array('connexion','deconnexion')))
            require_once('vues/'.$_GET['_page'].'.php');
        else
        {
            require_once('vues/header.php');
            echo'<div class="container clearfix">
                    <div class="col-sm-2"><div class="menu-gauche">'; require_once('vues/menu.php');echo'</div></div>
                    <div class="col-sm-9 menu-droite">';
                    if(!isset($_GET['_act'])&&!in_array($_GET['_page'],array('accueil','compte','profil')))
                        include('vues/filtre.php');
                    require_once('vues/'.$_GET['_page'].'.php');
            echo'   </div>
                </div><div class="clearfix"></div>';
                require_once('vues/footer.php');
        }
    ?>
    <script src='js/mask-js.js'></script>
    <script src='js/bootstrap.min.js'></script>
    <script src='js/bootstrap-select.js'></script>
    <script src='js/general-js.js'></script>
    <script src="js/select2.js"></script>
    <script>
        $(document).ready(function(e){
                $(".toUp").on("keyup change",function(e){$(this).val(this.value.toUpperCase());});
                $('select').select2({
                    placeholder: "Select a State",allowClear: true
                });
            });
    </script>
</body>
</html>

根据呼叫URL加载页面的内容。

请我需要知道如何克服这个问题。

感谢所有人

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)