小编Lon*_*ith的帖子

Nginx Fast CGI cache ON error_page 404

我想缓存(fast_cgi)404响应.

error_page 404 = /url_rewriting.php;
Run Code Online (Sandbox Code Playgroud)

在我的url_rewriting.php中,我使用php生成图像:

if(strpos($_SERVER['REQUEST_URI'], 'render/framed/file') !== FALSE) {
    $urlBlocks = ['VR', 'sizePixels', 'image', 'ver', 'frame', 'borderSize', 'mat', 'matSize', 'maxSize', 'frameGlass', 'minSize'];
    foreach($urlBlocks as $oneBlock) {
        if($pos = array_search($oneBlock, $urlParts)) {
            if(isset($urlParts[($pos+1)]) && $urlParts[($pos+1)] != '') {
                $_GET[$oneBlock] = urldecode($urlParts[($pos+1)]);
            }
        }    
    }

    chdir('include/php/render/framed');
    header('Status: 200 OK', false, 200);
    require ('include/php/render/framed/render_img.php');
}
Run Code Online (Sandbox Code Playgroud)

通过这种方式,我可以在HTML中拥有图像src URL,如下所示:

https://mywebsite.com/include/php/render/framed/file/VR/1/size/300/image/U3dpwK/the-cat.jpg

哪个jpg文件不存在但由PHP生成.

但我没有找到任何方法与Nginx缓存这些PHP生成的图像.

我试过这个:

set $no_cache 0;

location ~ /render/ {
        include snippets/fastcgi-php.conf;
        #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_pass 127.0.0.1:9000;

        fastcgi_buffers 8 16k; # increase the buffer …
Run Code Online (Sandbox Code Playgroud)

php caching nginx http-status-code-404

7
推荐指数
1
解决办法
1443
查看次数

取回状态参数 google api 登录

我有一个基于本教程https://www.sanwebe.com/2012/11/login-with-google-api-php的谷歌签名按钮,效果很好。

我正在尝试添加状态参数,因此我添加了以下行:

$client->setState("testingthestate"); 
Run Code Online (Sandbox Code Playgroud)

这行代码添加到 URL 中:https://....&state=testingthestate

但我不知道如何恢复状态的价值。和$_GET['state']都是$_POST['state']空的!

如何取回状态参数值?

php google-api oauth-2.0

5
推荐指数
1
解决办法
2421
查看次数

存储在我的数据库条带客户ID中是危险的吗?

例如,如果我的MysQL数据库被盗,小偷是否可以使用Stripe客户ID来收取费用?

我应该将这些ID存储在我的数据库中吗?存储它们但加密它们?

谢谢.

database stripe-payments

5
推荐指数
1
解决办法
1961
查看次数

自定义引导程序导航选项卡的边界线

如何自定义导航标签边框的颜色,默认为浅灰色?我可以更改颜色内容 div:http : //jsfiddle.net/cjz9dyen/

我试过了:

.nav-tabs > li.active > a {
    border-color: #d45500;
}
Run Code Online (Sandbox Code Playgroud)

但它在底部添加了一个边框。

tabs border twitter-bootstrap

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

如何使用bootstrap中的selectpicker插件设置所选选项

我正在使用Bootstrap-Select:

<select name="SelectAddress" class="selectpicker">
   <option value="a">Val 1</option>
   <option value="b">Val 2</option>
   <option value="c">Val 3</option>
   <option value="d">Val 4</option>
</select>
Run Code Online (Sandbox Code Playgroud)

例如,我想Val 1改为Val 1.0知道Val 1被选中.所以我尝试没有成功:

$("select[name=SelectAddress]").text("Val 1.0");
$("select[name=SelectAddress]").selectpicker("refresh");
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

编辑:

找到一个解决方案,在每个上面插入一个ID <option>:

<select name="SelectAddress" class="selectpicker">
   <option id="1" value="a">Val 1</option>
   <option id="2" value="b">Val 2</option>
   <option id="3" value="c">Val 3</option>
   <option id="4" value="d">Val 4</option>
</select>
Run Code Online (Sandbox Code Playgroud)

然后:

$("#1").html("Val 1.0");
$("select[name=SelectAddress]").selectpicker("refresh");
Run Code Online (Sandbox Code Playgroud)

html jquery twitter-bootstrap bootstrap-selectpicker

4
推荐指数
1
解决办法
8308
查看次数

带分隔符的 Bootstrap 按钮组

如何获取每个按钮之间带有边框线分隔符的 Bootstrap 按钮组?

<div class="btn-group" role="group" aria-label="Button group with nested dropdown">
  <button type="button" class="btn btn-secondary">1</button>
  <button type="button" class="btn btn-secondary">2</button>
</div>
Run Code Online (Sandbox Code Playgroud)

https://getbootstrap.com/docs/4.6/components/button-group

@padaleiana 解决方案运行良好!我使用了 btn-light 禁用按钮作为分隔符。

在此输入图像描述

css border button twitter-bootstrap bootstrap-4

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