* Fix bug for php7.2.
This commit is contained in:
@@ -170,10 +170,12 @@ function formatTime($time, $format = '')
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function __autoload($class)
|
||||
function autoloader($class)
|
||||
{
|
||||
if(!class_exists($class))
|
||||
{
|
||||
if($class == 'post_max_size' or $class == 'max_input_vars') eval('class ' . $class . ' {};');
|
||||
}
|
||||
}
|
||||
|
||||
spl_autoload_register('autoloader');
|
||||
@@ -43,7 +43,17 @@ class pinyin
|
||||
*/
|
||||
public function prepare($string)
|
||||
{
|
||||
$string = preg_replace_callback('/[a-z0-9_-]+/i', create_function('$matches', 'return "\t" . $matches[0];'), $string);
|
||||
if(version_compare(PHP_VERSION, '7.2.0') >= 0)
|
||||
{
|
||||
$string = preg_replace_callback('/[a-z0-9_-]+/i', function($matches)
|
||||
{
|
||||
return "\t" . $matches[0];
|
||||
}, $string);
|
||||
}
|
||||
else
|
||||
{
|
||||
$string = preg_replace_callback('/[a-z0-9_-]+/i', create_function('$matches', 'return "\t" . $matches[0];'), $string);
|
||||
}
|
||||
return preg_replace("/[^\p{Han}\p{P}\p{Z}\p{M}\p{N}\p{L}\t]/u", '', $string);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user