小编Tri*_*e C的帖子

Nginx - 我真的需要网站可用和网站启用的文件夹吗?

我已经搜索了Stack Overflow的直接答案,但还没有找到它.我注意到我的nginx安装有三个文件夹

etc/nginx/sites-available
etc/nginx/sites-enabled
etc/nginx/conf.d
Run Code Online (Sandbox Code Playgroud)

如果我只是想直接在etc/nginx/nginx.conf文件中工作并删除include包含这些项目的行,我真的需要这些nginx.conf吗?如果删除它们,这些目录是否用于其他任何会弄乱的东西?

nginx

11
推荐指数
3
解决办法
8044
查看次数

PHP将字符串中每个第一个字符的位置放入数组中

给定一个字符串,例如:

$string = "  this     is   a   string  ";
Run Code Online (Sandbox Code Playgroud)

返回包含一个数字的csv数组的最佳方法是什么,每个单词代表其第一个字符位置,如下所示:

$string = "  this     is   a   string  ";
             ^        ^    ^   ^
             2        11   16  20
Run Code Online (Sandbox Code Playgroud)

理想情况下,输出只是一个数组:

2,11,16,20
Run Code Online (Sandbox Code Playgroud)

到目前为止,这就是我所拥有的,但我认为鉴于我的技能有限,这有点过头了:

$string = "  this     is   a   string  ";
$string = rtrim($string); //just trim the right sides spaces
$len = strlen($string);
$is_prev_white = true;
$result = "";
for( $i = 0; $i <= $len; $i++ ) {
    $char = substr( $string,$i,1);
    if(!preg_match("/\s/", $char) AND $prev_white){
        $result .= $i.",";
        $prev_white = false;
    }else{ …
Run Code Online (Sandbox Code Playgroud)

php regex position

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

Jquery禁用按钮,直到两个输入具有最小长度

我试图保持输入禁用,直到2个输入至少有4个字符.我能在SO上找到的最接近的是一个用户总共8个字符,但是这将允许其中一个输入为空白而另一个超过8.这是我尝试过的:

没有 on()

$('#ancestor input').keyup(function(){
  var foo = $('input[name=foo]').val();
  var bar = $('input[name=bar]').val();    
    if(foo.length > 4 && bar.length > 4){  
      $('#some-button').prop('disabled', false);
      }else{
      $('#some-button').prop('disabled', true);
      }  
});
Run Code Online (Sandbox Code Playgroud)

on()

$('#ancestor input').on('keyup',function(){
  var foo = $('input[name=foo]').val();
  var bar = $('input[name=bar]').val();    
    if(foo.length > 4 && bar.length > 4){  
      $('#some-button').prop('disabled', false);
      }else{
      $('#some-button').prop('disabled', true);
      }  
});
Run Code Online (Sandbox Code Playgroud)

有趣的是,我可以console.log(foo.length)并且console.log(bar.length)看到每个长度都很好keyup.

javascript jquery

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

C#创建int和数组的字典

如何创建一个包含int作为键和数组作为Value的字典。这是我在dotnetfiddle.net上尝试过的没有运气的方法:

Dictionary<int, double[]> dict;
double[] prices = new double[20];
dict = new Dictionary<int, prices>();

Dictionary<int, double[]> dict;
dict = new Dictionary<int, new double[20]>();

Dictionary<int, double[]> dict;
dict = new Dictionary<int, double[20]>();
Run Code Online (Sandbox Code Playgroud)

.net c# dictionary

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

标签 统计

.net ×1

c# ×1

dictionary ×1

javascript ×1

jquery ×1

nginx ×1

php ×1

position ×1

regex ×1