我怎样才能解决这个错误,这样我就可以继续为我的网站注册和登录系统


How can I fix this error so I may proceed making a register and login system for my website?

我知道php越来越老了,但它是唯一的编码,我部分知道,是足够容易用于注册和登录系统。如果需要更多的编码或信息,请在标记为非问题之前询问。

我一直收到下面的错误。包括我的init.php和config.php。为了保护我的网站,Mysql信息已被更改。

解析错误:语法错误,意想不到的T_FUNCTION,期待')'在/home/a5236314/public_html/ooplr/core/init.php第20行

init.php

<?php
session_start();
$GLOBALS['config'] = array(
'mysql' => array(
    'host' => '127.0.0.1',
    'username' => 'root',
    'password' => '',
    'db' => 'lr'
),
'remember' => array(
    'cookie_name' => 'hash',
    'cookie_expiry' => 604800
),
'session' => array(
    'session_name' => 'user'
)
);
spl_autoload_register(function($class){  // 'This is line 20'
require_once 'classes/' . $class . '.php';
});
require_once 'functions/sanitize.php';

config。

<?php
class Config{
public static function get($path = null) {
    if($path) {
        $config = $GLOBALS['config'];
        $path = explode('/', $path);
        print_r($path);
    }
}
}

在5.3以前的PHP版本中,匿名函数被视为语法错误。要传递回调函数,可以这样做:

function callback($class){  
    require_once 'classes/' . $class . '.php';
}
spl_autoload_register('callback');