小编2ac*_*ary的帖子

MySQL JSON_EXTRACT路径表达式错误

语法看起来对我来说,任何帮助将不胜感激!

mysql> select fieldnames from tablename limit 5;
+--------------------------------------------------------+
| fieldnames                                             |
+--------------------------------------------------------+
| {"example-field-1": "val2"}                            |
| {"example-field-2": "val1"}                            |
| {"example-field-1": "val1", "example-field-3": "val1"} |
| {"example-field-2": "val1"}                            |
| {"example-field-2": "val2"}                            |
+--------------------------------------------------------+
mysql> select JSON_EXTRACT(fieldnames, '$.example-field-1') from tablename;
ERROR 3143 (42000): Invalid JSON path expression. The error is around character position 17 in '$.example-field-1'.
Run Code Online (Sandbox Code Playgroud)

MySQL 5.7.10

mysql json

12
推荐指数
1
解决办法
9157
查看次数

NGINX 根据标头的值设置 cookie

我正在尝试让 NGINX 检查请求标头user_header_token是否存在。如果它不存在,则重定向到登录站点。如果存在,请使用标头的值设置 cookie。当前设置的 cookie 是空的,而不是$http_我试图将其设置为的变量。有没有人看到我在做什么阻止将此 cookie 设置为标头的值?

http {
    include /etc/nginx/mime.types;
    server {
        listen 80;
        location / {
            if ($http_user_header_token = "") {
                rewrite ^.*$ https://loginsite.com/;
                return 403;
            }

            add_header Set-Cookie user_header_token=$http_user_header_token;

            root /usr/src/ui/;
            index index.html;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

cookies header http nginx

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

cookies ×1

header ×1

http ×1

json ×1

mysql ×1

nginx ×1