分类 技术专栏 下的文章

1、清除应用程序缓存

php artisan cache:clear

2、路由缓存

php artisan route:clear  // 关闭路由缓存
php artisan route:cache // 开启路由缓存 【开发环境,不要开启】

3、配置缓存

php artisan config:clear  // 清除配置缓存
php artisan config:cache // 开启配置缓存

4、清除视图缓存

php artisan view:clear

5、配置缓存

php artisan config:clear

6、路由缓存

php artisan route:clear

原文参考:https://www.cnblogs.com/e0yu/p/16487979.html

1、GLOBLES['HTTP_RAW_POST_DATA']

如果访问原始POST数据不是php能够识别的文档类型,比如:text/xml 或者soap等等,可以用$GLOBLES['HTTP_RAW_POST_DATA']来接收,$HTTP_RAW_POST_DATA变量包含有原始POST数据。此变量仅在碰到未识别的MIME数据时产生。

注:$HTTP_RAW_POST_DATA对于enctype="multipart/form-data"表单数据不可用,也就是说使用$HTTP_RAW_POST_DATA无法接受网页表单post过来的数据。

2、file_get_contents("php://input");

如果访问原始POST数据,更好的方法是使用file_get_content("php://input");对于未指定Content-Type的POST数据,可以使用该方法读取POST原始数据,包括二进制流也可以和$HTTP_RAW_POST_DATA比起来。它带来的生存眼里更小,并且不需要任何特殊的php.ini设置。

注:php://input不能用于 enctype="multipart/form-data"

主要用于筛查必须包含和必须不包含,直接上代码:

$params = [
            'index' => 'arctile_list',
            'type' => 'arctile_type',
            'body' => [
                'query' =>[
                    'bool' =>[
                        'must' => [
                            [
                                'bool' =>[
                                    'should' =>[
                                        [
                                            'match_phrase' =>[
                                                'title' => '测试1'
                                            ]
                                        ],
                                        [
                                            'match_phrase' =>[
                                                'title' => '测试2'
                                            ]
                                        ],
                                        [
                                            'match_phrase' =>[
                                                'title' => '测试3'
                                            ]
                                        ],
                                        [
                                            'match_phrase' =>[
                                                'title' => '测试4'
                                            ]
                                        ],
                                    ]
                                ]
                            ]

                        ],
                        'must_not' => [
                            'bool' =>[
                                'should' => [
                                    [
                                        'match_phrase' =>[
                                            'title' => 'test1'
                                        ]
                                    ],
                                    [
                                        'match_phrase' =>[
                                            'title' => 'test2'
                                        ]
                                    ],
                                    [
                                        'match_phrase' =>[
                                            'title' => 'test3'
                                        ]
                                    ],
                                ]
                            ]

                        ]
                    ]
                ],
                'sort'=> [
                    'pubdate'=> [ 'order'=> 'desc' ],
                ]
            ],
            'from' => 0,
            'size' => 1,
        ];

今天在开发过程中,.env里面新增了一台阿里云数据库,但是本地接口测试链接的时候,报错:SQLSTATE[HY000] [2002] No route to host,用navicat链接测试,没有问题,说明账号没有问题,本地链接ok,但是在docker环境下,还是报错,所以考虑阿里云数据库是否需要添加白名单,因为本地docker地址为192.168.65.0/24,所以将192.168.65加上白名单,修改完成后,重新测试本地端口,接口不在报错,数据正常返回