Skip to content

Commit 54fc7de

Browse files
committed
兼容composer和手工下载
1 parent 3962c24 commit 54fc7de

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

client/webserver_for_im.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
<?php
22
define('DEBUG', 'on');
3-
define("WEBPATH", realpath(__DIR__ . '/../'));
3+
define('WEBPATH', __DIR__);
4+
define('ROOT_PATH', dirname(__DIR__));
5+
6+
if (is_file(ROOT_PATH.'/framework/libs/lib_config.php'))
7+
{
8+
require ROOT_PATH.'/framework/libs/lib_config.php';
9+
}
10+
else
11+
{
12+
require_once ROOT_PATH.'/vendor/autoload.php';
13+
Swoole\Loader::vendor_init();
14+
}
415

5-
require_once __DIR__.'/../vendor/autoload.php';
6-
Swoole\Loader::vendor_init();
716
Swoole\Loader::addNameSpace('WebIM', __DIR__.'/src/');
817
Swoole::$php->config->setPath(__DIR__.'/apps/configs');
918

10-
$AppSvr = new Swoole\Protocol\HttpServer();
11-
$AppSvr->loadSetting(__DIR__.'/../swoole.ini'); //加载配置文件
19+
$AppSvr = new Swoole\Protocol\AppServer();
20+
$AppSvr->loadSetting(ROOT_PATH.'/swoole.ini'); //加载配置文件
1221
$AppSvr->setDocumentRoot(__DIR__);
22+
$AppSvr->setAppPath(__DIR__.'/apps/');
1323
$AppSvr->setLogger(new \Swoole\Log\EchoLog(true)); //Logger
1424

1525
$server = new \Swoole\Network\Server('0.0.0.0', 8888);

0 commit comments

Comments
 (0)