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

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));

}


梦里花落0921
浏览 136回答 1
1回答

一只甜甜圈

这是一个拼写错误。你现在用的$request->$categories,应该是$request->categories。删除多余的美元 ( $) 符号。$article->categories()->attach($request->categories);
打开App,查看更多内容
随时随地看视频慕课网APP