var FirstString_Ar=feeback.pathname.split("/");            // 沒有第二筆資料進入  FirstString_Ar[1] 指令
  ShortCommadSucess_fg=false;
  console.log("ShortCommadSucess_fg ="+ShortCommadSucess_fg);
    console.log("FirstString_Ar[0] = "+FirstString_Ar[0])
    console.log("FirstString_Ar[1] = "+FirstString_Ar[1])
  for(a=0 ; a<=Shortcommad_ay.length;a++)
  {
    if(FirstString_Ar[1]===Shortcommad_ay[a])
    {
      if(FirstString_Ar[1]==="MachineTemperature")
      {
          var fs = require('fs')
        ShortRootPath_A="C:\\Agilent_i1000\\Report\\MQTT log\\";
		      ShortRootPath_A=ShortRootPath_A+"MachineTemperature.json";			
        fs.stat(ShortRootPath_A, function(err, stat)                      // 
        {
          if(stat&&stat.isFile()) 
          {           
            fs.readFile(ShortRootPath_A, function (err, data)
            {
              console.log(data.toString());
              ShortCommadSucess_fg=true;
              res.write(data);
              ShortRootPath_A=null;
              res.end();         
              console.log("ShortCommadSucess_fg ="+ShortCommadSucess_fg);
            });
          }  
          else 
          {
            console.log("400 Bad Request. The < "+ShortRootPath_A+" > not found.");
            res.write("400 Bad Request. The < "+ShortRootPath_A+" > not found.");
            res.end();         
          }
        }) //*/	
      }
      if(FirstString_Ar[1]==="MachineConfiguration")
      {
          var fs = require('fs')
		      console.log("in")
        ShortRootPath_A="C:\\Agilent_i1000\\Report\\MQTT log\\";
        ShortRootPath_A=ShortRootPath_A+"MachineConfiguration.json"
        console.log("ShortRootPath_A ="+ShortRootPath_A);
        fs.stat(ShortRootPath_A, function(err, stat)                      // 
        {
          if(stat&&stat.isFile()) 
          {           
            fs.readFile(ShortRootPath_A, function (err, data)
            {
              console.log(data.toString());
              res.write(data);
              ShortRootPath_A=null;
//                  ShortCommadSucess_fg=true;
res.end();
});
}
else
{
console.log("400 Bad Request. The < "+ShortRootPath_A+" > not found.");
res.write("400 Bad Request. The < "+ShortRootPath_A+" > not found.");
res.end();
}
}) ///	
}			
if(FirstString_Ar[1]==="DiagnosticTestResults")
{
var fs = require('fs')
ShortRootPath_A="C:\Agilent_i1000\Report\MQTT log\";
ShortRootPath_A=ShortRootPath_A+"DiagnosticTestResults.json"
console.log("ShortRootPath_A ="+ShortRootPath_A);
fs.stat(ShortRootPath_A, function(err, stat)                      //
{
if(stat&&stat.isFile())
{
fs.readFile(ShortRootPath_A, function (err, data)
{
console.log(data.toString());
res.write(data);
ShortRootPath_A=null;
//                  ShortCommadSucess_fg=true;
res.end();
});
}
else
{
console.log("400 Bad Request. The < "+ShortRootPath_A+" > not found.");
res.write("400 Bad Request. The < "+ShortRootPath_A+" > not found.");
res.end();
}
}) ///	
}						
}
}
console.log("ShortCommadSucess_fg ="+ShortCommadSucess_fg);
/*      if(ShortCommadSucess_fg===false)
{
console.log("400 Bad Request. The < "+FirstString_Ar[1]+" > not found.");
//        res.write("400 Bad Request. The < "+FirstString_Ar[1]+" > not found.");
res.end();
} //*/
}
ShortCommadSucess_fg=false;
}
}).listen(1337);
程式碼如上,我要讓for裡面的條件如果都不符合(即ShortCommadSucess_fg都沒=true),要輸出最下方mark起來的部分if(ShortCommadSucess_fg===false)
但我只要取消隱藏,就會在命令提是字元里顯示 write after end 可否請高手教導我,我到底哪裡有少寫,或哪裡沒寫好,