有没有办法简化这个htaccess代码?

时间:2016-12-21 08:47:47

标签: php apache .htaccess mod-rewrite

请告诉我,

如果有任何方法可以将此htaccess代码简化为2行。

RewriteCond %{HTTPS} on
RewriteRule ^/demo1/ordercheck$ http://www.mywebsite.com/demo1/ordercheck.php [R=301,L]

RewriteCond %{HTTPS} on
RewriteRule ^/demo2/ordercheck$ http://www.mywebsite.com/demo2/ordercheck.php [R=301,L]

RewriteCond %{HTTPS} on
RewriteRule ^/demo3/ordercheck$ http://www.mywebsite.com/demo3/ordercheck.php [R=301,L]

由于

1 个答案:

答案 0 :(得分:1)

试试这个。

//manage automatic set of the selection
bool isAutomaticSelected = false;
mySpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
  @Override
  public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
    //manage the bool
    if(isAutomaticSelected){ 
      isAutomaticSelected = false;
    }
    else{
      mySpinner.setSelection(1); //or any index u want
      isAutomaticSelected = true;
    }
  }

  @Override
  public void onNothingSelected(AdapterView<?> parentView) {
    if(isAutomaticSelected){ 
      isAutomaticSelected = false;
    }
    else{
      mySpinner.setSelection(1); //or any index u want
      isAutomaticSelected = true;
    }
  }

});