Parse error: syntax error, unexpected 'class' (T_CLASS) in /www/wwwroot/tadyzx.com/application/common.php on line 15

[4] ErrorException in common.php line 15

syntax error, unexpected 'class' (T_CLASS)

  1. // +----------------------------------------------------------------------
  2. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  3. // +----------------------------------------------------------------------
  4. // | Author: 流年 <liu21st@gmail.com>
  5. // +----------------------------------------------------------------------
  6. use think\facade\Request;
  7. use think\facade\Env;
  8. // 自定义 404
  9. \think\Container::get('app')->bind('think\exception\Handle', function() {
  10. return new class extends \think\exception\Handle {
  11. public function render(\Exception $e)
  12. {
  13. // 如果是 404 错误
  14. if ($e instanceof HttpException && $e->getStatusCode() == 404) {
  15. header("HTTP/1.1 404 Not Found");
  16. include $_SERVER['DOCUMENT_ROOT'] . '/404.php';
  17. exit;
  18. }
  19. return parent::render($e); // 其它错误照常处理

Call Stack

  1. in common.php line 15
  2. at Error::appShutdown()

Environment Variables

GET Data
s /miyu/304.html
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
FCGI_ROLE RESPONDER
SCRIPT_FILENAME /www/wwwroot/tadyzx.com/public/index.php
QUERY_STRING s=/miyu/304.html
REQUEST_METHOD GET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_NAME /index.php
REQUEST_URI /miyu/304.html
DOCUMENT_URI /index.php
DOCUMENT_ROOT /www/wwwroot/tadyzx.com/public
SERVER_PROTOCOL HTTP/2.0
REQUEST_SCHEME https
HTTPS on
GATEWAY_INTERFACE CGI/1.1
SERVER_SOFTWARE nginx/1.26.3
REMOTE_ADDR 216.73.216.105
REMOTE_PORT 23672
SERVER_ADDR 218.67.82.142
SERVER_PORT 443
SERVER_NAME m.tadyzx.com
REDIRECT_STATUS 200
HTTP_HOST www.tadyzx.com
PATH_INFO
HTTP_ACCEPT */*
HTTP_USER_AGENT Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_ACCEPT_ENCODING gzip, br, zstd, deflate
HTTP_REFERER https://tadyzx.com/miyu/304.html
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1758220513.3512
REQUEST_TIME 1758220513
Environment Variablesempty
ThinkPHP Constantsempty