api/index.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
date_default_timezone_set('UTC');
require_once __DIR__ . '/bootstrap.php';
use Symfony\Component\HttpFoundation\Response;
use Topxia\Api\ApiAuth;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
include __DIR__.'/src/functions.php';
$app = new Silex\Application();
$app['biz'] = function (){
global $kernel;
return $kernel->getContainer()->get('biz');
};
$app->register(new Silex\Provider\ServiceControllerServiceProvider());
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/templates',
));
include __DIR__ . '/config/' . API_ENV . '.php';
$app->before(function (Request $request) use ($app) {
$auth = new ApiAuth(include __DIR__ . '/config/whitelist.php');
$auth->auth($request);
});
$app->error(function (\Exception $exception, Request $request, $code) use ($app) {
$error = array(
'code' => $code,
'message' => $exception->getCode() > 0 ? $exception->getMessage() : '服务器内部错误',
);
if ($app['debug']) {
$error['message'] = $exception->getMessage();
if (!$exception instanceof FlattenException) {
$exception = FlattenException::create($exception);
}
$error['previous'] = array();
$flags = PHP_VERSION_ID >= 50400 ? ENT_QUOTES | ENT_SUBSTITUTE : ENT_QUOTES;
$count = count($exception->getAllPrevious());
$total = $count + 1;
foreach ($exception->toArray() as $position => $e) {
$previous = array();
$ind = $count - $position + 1;
$previous['message'] = "{$ind}/{$total} {$e['class']}: {$e['message']}";
$previous['trace'] = array();
foreach ($e['trace'] as $position => $trace) {
$content = sprintf('%s. ', $position+1);
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。