NetworkError : 500 내부 서버 오류가 발생했습니다
-
21-12-2019 - |
문제
이 파일을 실행하려고하면 나에게 검은 페이지를 보여줍니다 ..
i Firebug를 시작합니다. NetworkError : 500 내부 서버 오류가 표시됩니다. 나는 해결하려고 노력했지만 여기서 아무런 문제를 찾지 못한다.
오류나 문제가 무엇인지 찾아내도록 도와 주실 수 있습니까?
class DesEncryptor
{
protected $_key;
protected $_iv;
protected $_blocksize = 8;
protected $_encrypt;
protected $_cipher;
/**
* Creates a symmetric Data Encryption Standard (DES) encryptor object
* with the specified key and initialization vector.
*
* @param $key
* @param $iv
* @param bool $encrypt
*/
public function __construct($key, $iv, $encrypt = true)
{
$this->_key = $key;
$this->_iv = $iv;
$this->_encrypt = $encrypt;
$this->_cipher = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_CBC, '');
mcrypt_generic_init($this->_cipher, $this->_key, $this->_iv);
}
public function __destruct()
{
mcrypt_generic_deinit($this->_cipher);
mcrypt_module_close($this->_cipher);
}
/**
* Transforms the specified region of the specified byte array using PCKS7 padding.
* @param $text
* @return string
*/
public function transformFinalBlock($text)
{
if ($this->_encrypt)
{
$padding = $this->_blocksize - strlen($text) % $this->_blocksize;
$text .= str_repeat(pack('C', $padding), $padding);
}
$text = $this->transformBlock($text);
if (!$this->_encrypt)
{
$padding = array_values(unpack('C', substr($text, -1)))[0];
$text = substr($text, 0, strlen($text) - $padding);
}
return $text;
}
/**
* Transforms the specified region of the specified byte array.
* @param $text
* @return string
*/
public function transformBlock($text)
{
if ($this->_encrypt)
{
return mcrypt_generic($this->_cipher, $text);
}
else
{
return mdecrypt_generic($this->_cipher, $text);
}
}
}
.
VAR_DUMP ()로 디버그 할 때 FUNCTION TransformFinalBlock
$padding = array_values(unpack('C', substr($text, -1)))[0];
.
" '' '예기치 않은"
와 같은 오류를 던집니다.jys, 솔루션 plz ...
해결책
배열 $padding = array_values(unpack('C', substr($text, -1)))[0];
라인으로 수행하는 일은 PHP 5.4 사전 버전에서는 배열에 액세스하려면 다음을 수행해야합니다.
$arr = array_values(unpack('C', substr($text, -1)));
$padding = $arr[0];
. 제휴하지 않습니다 StackOverflow