本文整理汇总了PHP中server::config方法的典型用法代码示例。如果您正苦于以下问题:PHP server::config方法的具体用法?PHP server::config怎么用?PHP server::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server
的用法示例。
在下文中一共展示了server::config方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_config
private static function load_config()
{
$config = snarf_scope(SERVER_ROOT . '/config.php');
$config['address'] = $address = getArg('a', 'address', get($config, 'ip', '0.0.0.0'));
$port = get($config, 'port', 10000);
if (strpos($address, ':') !== false) {
$parts = explode(':', $address);
$address = $parts[0];
$port = (int) $parts[1];
}
$config['port'] = getArg('p', 'port', $port);
self::$config = $config;
}
示例2: error_reporting
/*
* copyright Ryan Day 2010
* http://ryanday.org
* dual licensed gpl and mit
*/
error_reporting(E_ALL);
define('SERVER_ROOT', dirname(__FILE__));
define('MODULE_PATH', SERVER_ROOT . '/modules');
require SERVER_ROOT . '/lib/server.php';
require SERVER_ROOT . '/lib/response.php';
server::init($sockets, $clients);
if (($listen = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) {
die("socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n");
}
socket_set_option($listen, SOL_SOCKET, SO_REUSEADDR, 1);
if (socket_bind($listen, server::config('address'), server::config('port')) === false) {
die("socket_bind() failed: reason: " . socket_strerror(socket_last_error($listen)) . "\n");
}
if (socket_listen($listen, 5) === false) {
die(" socket_listen() failed: reason: " . socket_strerror(socket_last_error($listen)) . "\n");
}
$sockets[] = $listen;
$clients[] = null;
do {
$read = $sockets;
$write = null;
$except = null;
$r = socket_select($read, $write, $except, null);
if ($r === false) {
$err = socket_strerror(socket_last_error());
echo "[ERROR] socket_select() failed, reason: {$err}\n";