guiyumin 发布的文章

If you look at it tells you that after installing @vue/cli-service ( which may be part of the standard CLI installation ) then vue-cli-service is available in npm scripts, but that if you want to access it directly then you need to use ./node_modules/.bin/vue-cli-service This worked for me, and I guess you could add ./node_modules/.bin to your $PATH if you were so inclined.

- 阅读剩余部分 -

Title: How to verify json web token (jwt) signature by using PHP native functions?

class Jsonwebtoken()
   public static function verify(string $token)
        /**应该学习firebase jwt lib,做大量错误处理 */
        $tokenParts = explode('.', $token);
        list($headb64, $bodyb64, $cryptob64) = $tokenParts;

        /** both work */
        $pubKey = openssl_get_publickey('file://'.__DIR__.'/');
        // $pubKey = file_get_contents(__DIR__.'/');

        $signature = self::urlsafeB64Decode($cryptob64); // from Google Firebase JWT lib

        $isVerified = openssl_verify("$headb64.$bodyb64", $signature, $pubKey, OPENSSL_ALGO_SHA256);

        return $isVerified === 1; // openssl_verify return value is int

     * Decode a string with URL-safe Base64.
     * @param string $input A Base64 encoded string
     * @return string A decoded string
    public static function urlsafeB64Decode(string $input)
        $remainder = strlen($input) % 4;
        if ($remainder) {
            $padlen = 4 - $remainder;
            $input .= str_repeat('=', $padlen);
        return base64_decode(strtr($input, '-_', '+/'));

- 阅读剩余部分 -

$my_array = array("Dog","Cat","Horse");

list($a, $b, $c) = $my_array;
echo "I have several animals, a $a, a $b and a $c.";
// I have several animals, a Dog, a Cat and a Horse.

这个函数有点意思, 和ES6里面的 ...Array有点像。
这个函数的问题是,如果左边的$my_array比如只有2个元素,也就是是说count($my_array) ===2,这种情况就会导致报错,因为数组越界了。所以应该增加一定的校验和错误处理。




Statements That Cannot Be Rolled Back

Some statements cannot be rolled back. In general, these include data definition language (DDL) statements, such as those that create or drop databases, those that create, drop, or alter tables or stored routines.

You should design your transactions not to include such statements. If you issue a statement early in a transaction that cannot be rolled back, and then another statement later fails, the full effect of the transaction cannot be rolled back in such cases by issuing a ROLLBACK statement.