[英]Phpseclib PHP Fatal error: Uncaught Error: Class
I followed the installation instructions.我按照安装说明进行了操作。 I created the folder and ran the composer.
我创建了文件夹并运行了作曲家。 I got the lock file and the vendor directory.
我得到了锁定文件和供应商目录。 I placed the JSON, lock files, and vendor directory on the server (hosted by GoDaddy).
我将 JSON、锁定文件和供应商目录放在服务器上(由 GoDaddy 托管)。
I created a simple PHP file with a decrypt function.我用解密 function 创建了一个简单的 PHP 文件。
<?php
require __DIR__ . '/vendor/autoload.php';
$ky = '2345678901234567890123456789012'; // 32 * 8 = 256 bit key
$iv = '2345678901234567890123456789012'; // 32 * 8 = 256 bit iv
function Decrypt($string_to_decrypt)
{
global $ky;
global $iv;
$cipher = new Crypt_Rijndael(CRYPT_RIJNDAEL_MODE_CBC);
$cipher->setBlockLength(256);
$cipher->setKeyLength(256);
$cipher->setKey($ky);
$cipher->setIV($iv);
$rtn= $cipher->decrypt($string_to_decrypt);
error_log('decrypt = '. $rtn, 0);
return($rtn);
}
I tried putting the following include in and it got further but then complained about the BlockCipher.我尝试将以下内容放入其中,它变得更进一步,但随后抱怨 BlockCipher。 I put another include in for that and got further.
我为此添加了另一个包含并进一步。 I know this is not the correct way.
我知道这不是正确的方法。 I would have thought the autoloader would have taken care of this.
我原以为自动加载器会处理这个问题。
include('/home/n28d5aun99s6/public_html/Working/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php');
Can someone please tell me what I am doing wrong?有人可以告诉我我做错了什么吗?
You do not have proper reference to that class. It lives in phpseclib3\Crypt
namespace but your code neither imports from there using use phpseclib3\Crypt\Rijndael
nor have FQN given in when referenced in new
.您没有对该 class 的正确引用。它位于
phpseclib3\Crypt
命名空间中,但您的代码既没有使用use phpseclib3\Crypt\Rijndael
从那里导入,也没有在new
中引用时给出 FQN。 Also the class name is Rijndael
and not Crypt_Rijndael
( source ) so you should first ensure your code is working locally before uploading it anywhere otherwise you will be wasting time debugging.此外,class 名称是
Rijndael
而不是Crypt_Rijndael
( 来源),因此您应该首先确保您的代码在本地工作,然后再将其上传到任何地方,否则您将浪费时间调试。
Also your hardcoded include
solves nothing and should be removed.此外,您的硬编码
include
没有解决任何问题,应将其删除。
Please read the about namespaces in PHP as you seem to have knowledge deficit on that matter.请阅读 PHP 中关于命名空间的内容,因为您似乎在这方面知识不足。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.