为了账号安全,请及时绑定邮箱和手机立即绑定

Laravel 中出现“未定义变量:类别”错误

Laravel 中出现“未定义变量:类别”错误

PHP
梦里花落0921 2023-06-24 15:20:36
public static boolean keyEquals(RSAPrivateCrtKey k1, RSAPrivateCrtKey k2) {    final BigInteger ZERO = BigInteger.ZERO;    boolean result = true;    result = result && isConsistent(k1) && isConsistent(k2);    result = result && k1.getModulus().equals(k2.getModulus());    BigInteger lambda = computeCarmichaelLambda(k1.getPrimeP(), k1.getPrimeQ());    result = result && k1.getPublicExponent().subtract(k2.getPublicExponent()).mod(lambda).equals(ZERO);    result = result && k1.getPrivateExponent().subtract(k2.getPrivateExponent()).mod(lambda).equals(ZERO);    return result;}private static boolean isConsistent(RSAPrivateCrtKey k1) {    final BigInteger ZERO = BigInteger.ZERO;    final BigInteger ONE = BigInteger.ONE;    BigInteger n = k1.getModulus();    BigInteger p = k1.getPrimeP();    BigInteger q = k1.getPrimeQ();    BigInteger e = k1.getPublicExponent();    BigInteger d = k1.getPrivateExponent();    boolean result = true;    result = p.multiply(q).equals(n);    BigInteger lambda = computeCarmichaelLambda(p, q);    result = result && e.multiply(d).mod(lambda).equals(ONE);    result = result && d.subtract(key.getPrimeExponentP()).mod(p.subtract(ONE)).equals(ZERO);    result = result && d.subtract(key.getPrimeExponentQ()).mod(q.subtract(ONE)).equals(ZERO);    result = result && q.multiply(k1.getCrtCoefficient()).mod(p).equals(ONE);    return result;}private static BigInteger computeCarmichaelLambda(BigInteger p, BigInteger q) {    return lcm(p.subtract(BigInteger.ONE), q.subtract(BigInteger.ONE));}private static BigInteger lcm(BigInteger x, BigInteger y) {    return x.multiply(y).divide(x.gcd(y));}
查看完整描述

1 回答

?
一只甜甜圈

TA贡献1836条经验 获得超5个赞

这是一个拼写错误。你现在用的$request->$categories,应该是$request->categories。删除多余的美元 ( $) 符号。

$article->categories()->attach($request->categories);


查看完整回答
反对 回复 2023-06-24
  • 1 回答
  • 0 关注
  • 94 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信