解析错误:语法错误,"页面URL"中的意外T_STRING

Vis*_*a S 0 php

<?php
    namespace security;
    class Pbkdf2
    {
        const HASH_ITERATIONS   = 6000;
        const SALT_ITERATIONS   = 10;
        const POMPOUS_SECRET    = <<<TOKEN
    vT@sw6b7,GD#orY8iQG%CbHLyzeziWFNWGnew=X]QuFfUtc(vP
    TOKEN;

        public static function generateRandomSalt($iterationCount = Pbkdf2::SALT_ITERATIONS)
        {
            if ($iterationCount < 10)
            {
                $iterationCount = 10;
            }
            $rand   = array();
            for ($i = 0; $i < $iterationCount; ++$i) {
                $rand[] = rand(0, 2147483647);
            }
            return strtolower(hash('sha256', implode('', $rand)));
        }

        public static function checklogin($password, $hash, $salt, $iterationCount = Pbkdf2::HASH_ITERATIONS)
        {
            $hashExpected   = self::hash($password, $salt, $iterationCount);
            return $hashExpected === $hash;
        }

        public static function hash($password, $salt, $iterationCount = Pbkdf2::HASH_ITERATIONS, $secret = Pbkdf2::POMPOUS_SECRET)
        {
            $hash   = $password;
            for ($i = 0; $i < $iterationCount; ++$i)
            {
                $hash   = strtolower(hash('sha256', $secret . $hash . $salt));
            }
            return $hash;
        }
    }

?>
Run Code Online (Sandbox Code Playgroud)

这是使用AJAX加载到另一个页面的PHP页面的代码.这会引发错误

解析错误:语法错误,第2行'page url'中的意外T_STRING.

可悲的事实是我没有在localhost中收到此错误.我只在服务器中看到此错误.

这背后隐藏的事实是什么?

dec*_*eze 9

您的服务器运行的旧PHP版本尚不支持名称空间.