Loading...
Доброе время всем!! Помогите пожалуйста что здесь не так выдаёт ошибку именно эта строка
plaintext
 function hash(int $lenght = 5) 
Вот весь код
plaintext
 <?php

class Core {
	
	public static function alert($string, $style='theme')
	{
		if(!empty($string))
		{
			return '<div class="alert alert-'.$style.' text-center">'.$string.'</div>';
		} else return false;
	}
	
	public function redirect($url)
	{
		if(!empty($url))
		{
			header('Location:'.$url);
			exit;
		} 
	}
	
	public function hash(int $count = 5)
	{
		if($count > 0)
		{
			return bin2hex(random_bytes($count));
		}
	}
	
	function hash(int $lenght = 5)
	{
		if($lenght > 0)
		{
			return bin2hex(random_bytes($lenght));
		}
	}
	
	public function setLog($text, $file = null, $type = 'info')
	{
	    if(empty($file))
	    {
	        $file = ROOT.'/logs/'.$type.'-'.date('H:i').'.txt';
	    }
		else
		{
		    $file = ROOT.'/logs/'.$file.'.txt';
		}
		
		if(!empty($text))
		{
			if(file_put_contents($file, $text, FILE_APPEND | LOCK_EX))
			{
				$result = true;
			}
			else $result = false;
			
		}
		else $result = NULL;
		
		return $result;
	}
}


?>
uNick, текст ошибки напиши
Сибирский, Fatal error: Cannot redeclare Core::hash() in /var/www/us_unick/data/www/unick.zadc.ru/system/classes/Core.class.php on line 30
Ну да, она у тебя 2 раза в классе прописана, удали одну
length может так надо писать? длина. а у тебя lenght.
Mobiman (04.07.2019 в 12:28)
length может так надо писать? длина. а у тебя lenght.
ну ка обьясни мне как это может быть ошибкой вовсе :)
Mobiman, это имя переменной, разницы нету
Сибирский, спасибо
нельзя метод называть - hash()
Онлайн: 0
Время:
Gen. 0.102
(c) Bym.Guru 2010-2026