| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
与其他Web框架不同,SwooleFramework是一个全功能的后端服务器框架。除了Web方面的应用之外,更广泛的后端程序中都可以使用。
最新版本的代码已经彻底废弃非命名空间代码,升级框架之后,apps/controller/和apps/models中的代码需要按照命名空间的规范修改一次
使用内置应用服务器,可节省每次请求代码来的额外消耗。连接池技术可以很好的帮助存储系统节省连接资源。
###Swoole应用服务器支持的特性###
###Swoole框架额外提供的网络协议###
在线体验地址:http://www.swoole.com/page/index/
{
"require": {
"matyhtf/swoole_framework": "dev-master"
}
}SwooleFramework应用服务器,需要安装swoole扩展。
pecl install swoole
然后修改php.ini加入extension=swoole.so
<?php
require __DIR__.'/libs/lib_config.php';
$AppSvr = new Swoole\Protocol\AppServer();
$AppSvr->loadSetting(__DIR__."/swoole.ini"); //加载配置文件
$AppSvr->setAppPath(__DIR__.'/apps/'); //设置应用所在的目录
$AppSvr->setLogger(new Swoole\Log\EchoLog(false)); //Logger
/**
*如果你没有安装swoole扩展,这里还可选择
* BlockTCP 阻塞的TCP,支持windows平台,需要将worker_num设为1
* SelectTCP 使用select做事件循环,支持windows平台,需要将worker_num设为1
* EventTCP 使用libevent,需要安装libevent扩展
*/
$server = new \Swoole\Network\Server('0.0.0.0', 8888);
$server->setProtocol($AppSvr);
$server->daemonize(); //作为守护进程
$server->run(array('worker_num' => 1, 'max_request' => 5000));php server.php
[2013-07-09 12:17:05] Swoole. running. on 0.0.0.0:8888在浏览器中打开 http://127.0.0.1:8888/
server {
listen 80;
server_name www.swoole.com;
root /data/wwwroot/www.swoole.com;
location / {
if (!-e $request_filename){
proxy_pass http://127.0.0.1:9501;
}
}
}<VirtualHost *:80>
ServerName www.swoole.com
DocumentRoot /data/webroot/www.swoole.com
DirectoryIndex index.html index.php
<Directory "/data/webroot/www.swoole.com">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
# ProxyPass /admin !
# ProxyPass /index.html !
# ProxyPass /static !
# ProxyPass / http://127.0.0.1:9501/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:9501$1 [L,P]
</IfModule>
</VirtualHost>| Back | FazBrowse Home | New Git URL |