Слияние кода завершено, страница обновится автоматически
<?php
use yii\base\ExitException;
// defined('YII_DEBUG') or define('YII_DEBUG', true);
// defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/threadtask/Application.php';
$config = require __DIR__ . '/config/threadtask.php';
$_SERVER['SCRIPT_FILENAME'] = __DIR__ . '/web/index.php';
$_SERVER['SCRIPT_NAME'] = '/index.php';
$onBody = function(HttpRequest $request) {
return true; // return onBody($request);
};
$onRequest = function(HttpRequest $request, HttpResponse $response) use(&$app, $config) { // return onRequest($request, $response);
static $db;
if($request->path !== '/' && $request->path !== '/.htaccess' && substr($request->path, -4) !== '.php') {
$path = __DIR__ . '/web' . $request->path;
if(file_exists($path)) return onMediaFile($request, $response, $path);
}
try {
$request->registerVars();
$config['components']['request']['request'] = $request;
$config['components']['response']['response'] = $response;
$displayErrors = ini_set('display_errors', false);
set_error_handler(function($code, $message, $file, $line) {
if(error_reporting() & $code) throw new ErrorException($message, $code, $code, $file, $line);
return false;
});
if($db) $config['components']['db'] = $db;
(new app\threadtask\Application($config))->run();
} catch(ExitException $e) {
} catch(\ExitRequest $e) {
return $e->getMessage();
} catch(\Throwable $e) {
if(\Yii::$app && ($errorHandler = \Yii::$app->get('errorHandler', false))) {
$errorHandler->handleException($e);
return null;
}
$response->status = 500;
$response->statusText = 'Internal Server Error';
$response->setContentType('text/plain; charset=utf-8');
if(YII_DEBUG) {
return (string) $e;
} else {
echo "$e\n";
return 'An internal server error occurred.';
}
} finally {
if(!$db && Yii::$app && Yii::$app->has('db', true)) {
$db = Yii::$app->getDb();
}
call_and_free_shutdown();
error_clear_last();
\Yii::getLogger()->flush(true);
Yii::$app = null;
restore_error_handler();
ini_set('display_errors', $displayErrors);
}
return null;
};
class ExitRequest extends \Exception {
}
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Комментарий ( 0 )