Skip to content

Commit 6c86efb

Browse files
committed
判断是否为Https
1 parent 1661a1d commit 6c86efb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

server/config.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@
44

55
if (!empty($_SERVER['SERVER_NAME']))
66
{
7-
define("WEBROOT", 'http://' . $_SERVER['SERVER_NAME']);
7+
$protocol = 'http';
8+
if ($_SERVER['SERVER_PORT'] == 443)
9+
{
10+
$protocol .= 's';
11+
}
12+
define("WEBROOT", $protocol . '://' . $_SERVER['SERVER_NAME']);
813
}
914
else
1015
{
11-
define("WEBROOT", 'http://www.swoole.com');
16+
define("WEBROOT", 'https://www.swoole.com');
1217
}
1318

1419
define("TABLE_PREFIX", 'st');
@@ -23,7 +28,7 @@
2328
define('LOGIN_TABLE','user_login');
2429

2530
require __DIR__.'/libs/lib_config.php';
26-
require __DIR__.'/admin/func.php';
31+
require __DIR__.'/apps/include/func.php';
2732

2833
if (get_cfg_var('env.name') == 'dev')
2934
{

0 commit comments

Comments
 (0)