本文整理匯總了PHP中PHPDaemon\Core\Daemon::compatMode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Daemon::compatMode方法的具體用法?PHP Daemon::compatMode怎麽用?PHP Daemon::compatMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHPDaemon\Core\Daemon
的用法示例。
在下文中一共展示了Daemon::compatMode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: compatRunEmul
/**
* It allows to run your simple web-apps in spawn-fcgi/php-fpm environment.
* @return boolean|null - Success.
*/
public static function compatRunEmul()
{
Daemon::$compatMode = TRUE;
Daemon::initSettings();
$argv = isset($_SERVER['CMD_ARGV']) ? $_SERVER['CMD_ARGV'] : '';
$args = \PHPDaemon\Core\Bootstrap::getArgs($argv);
if (isset($args[$k = 'configfile'])) {
Daemon::$config[$k] = $args[$k];
}
if (!Daemon::$config->loadCmdLineArgs($args)) {
$error = true;
}
if (isset(Daemon::$config->configfile->value) && !Daemon::loadConfig(Daemon::$config->configfile->value)) {
$error = true;
}
if (!isset(Daemon::$config->path->value)) {
exit('\'path\' is not defined');
}
if ($error) {
exit;
}
$appResolver = (require Daemon::$config->path->value);
$appResolver->init();
$req = new \stdClass();
$req->attrs = new \stdClass();
$req->attrs->request = $_REQUEST;
$req->attrs->get = $_GET;
$req->attrs->post = $_REQUEST;
$req->attrs->cookie = $_REQUEST;
$req->attrs->server = $_SERVER;
$req->attrs->files = $_FILES;
$req->attrs->session = isset($_SESSION) ? $_SESSION : null;
$req->attrs->connId = 1;
$req->attrs->trole = 'RESPONDER';
$req->attrs->flags = 0;
$req->attrs->id = 1;
$req->attrs->paramsDone = true;
$req->attrs->inputDone = true;
$req = $appResolver->getRequest($req);
while (true) {
$ret = $req->call();
if ($ret === 1) {
return;
}
}
}