你好开发者朋友。
我正在尝试使旧网站与 swolle 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 加载。
请我需要知道如何克服这个问题。
谢谢大家