我突然收到 502 Bad gateway 错误,我不明白为什么会出现此错误。而且此错误仅出现在 1 个单页上!...
我的 Nginx 日志中的确切错误是:
Upstream prematurely closed FastCGI stdout while reading response header from upstream [..] upstream: "fastcgi://unix:/var/run/php5-fpm.sock:"
Run Code Online (Sandbox Code Playgroud)
我试过 :
我的/var/log/upstart/php5-fpm.log(只有很多通知):
Terminating...
exiting, bye-bye!
fpm is running, pid 9887
ready to handle connections
systemd monitor interval set to 10000ms
Run Code Online (Sandbox Code Playgroud)
这让我发疯,有什么想法吗?
我尝试使用从 Firebase 数据库中检索到的每个节点中的数据修改字符串,然后使用修改后的字符串(称为“内容”)编写一个文件。
这是我尝试过的:
// Retrieve initial content from Firebase storage
var data = await FirebaseStorage.instance.ref().child("...").getData(1048576);
var content = new String.fromCharCodes(data);
// Edit content with each node from Firebase database
final response = await FirebaseDatabase.instance.reference().child('...').once();
response.value.forEach((jsonString) async {
...
// cacheManager.getFile returns a Future<File>
cacheManager.getFile(signedurl).then((file){
// Modify content
content=content.replaceAll('test',file.path);
});
});
// Finally write the file with content
print("test");
final localfile = File('index.html');
await localfile.writeAsString(content);
Run Code Online (Sandbox Code Playgroud)
结果 :
“test”显示在 forEach 结束之前。
我发现我们可以在 Dart ( https://groups.google.com/a/dartlang.org/forum/#!topic/misc/GHm2cKUxUDU ) 中做到:
等待 Future.forEach
但在我的情况下,如果我这样做:await Future.response.value.forEach(听起来有点奇怪) …
在 Dart 中,想检查目录是否存在但不知道该目录的子字符串:
例如:
目录=预览/1552146038702.jpg.1--001--001.html.test.jpg
我试过 :
io.Directory(await dir).exists().then((exist){
Run Code Online (Sandbox Code Playgroud)
但在目录中我不知道1--001--001.html
任何的想法?
这可能很简单,我想弹出一个小部件并传递不同的参数,这就是我所拥有的:
class MyScreen extends StatefulWidget {
final String param0;
final String param1;
final String param2;
MyScreen(param0,param1,param2);
@override
MyState createState() => new MyScreenState();
}
...
Run Code Online (Sandbox Code Playgroud)
我想回到这个传递参数的小部件,如下所示:
Navigator.pop(context, "NewParam0", "NewParam1", "NewParam2");
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
我可以使用 1 个参数和上下文来弹出,但它不适用于多个参数,
任何想法?
我使用PHPMailer发送电子邮件,evthg效果很好,但我会为每封电子邮件设置一个唯一的MessageID。
PHPMailer版本:“ v5.2.16”
(从https://github.com/PHPMailer/PHPMailer.git随Composer加载)
我在这里找到了文档:http : //phpmailer.github.io/PHPMailer/classes/PHPMailer.html#property_MessageID
所以这是我尝试的:
$mail = new PHPMailer;
...
$mail->MessageID = md5('HELLO'.(idate("U")-1000000000).uniqid()).'-'.$type.'-'.$id.'@domain.com';
Run Code Online (Sandbox Code Playgroud)
结果:这始终是PHPMailer生成的默认MessageID:
而不是我的... :(
然后我尝试sthg更简单:
$mail->MessageID = "blablag@domain.com";
Run Code Online (Sandbox Code Playgroud)
结果:KO(相同)
文档表明我们可以设置一个MessageID,它应该是一个字符串,我根本不明白为什么它不起作用...
任何的想法 ?
在Java中我尝试将字符串值转换为整数,删除最后4个字符,所以我尝试了这样:
String filename1="98597598684.txt";
int id = Integer.parseInt(filename1.substring(0, filename1.length()-4));
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误,我不明白为什么:
java.lang.NumberFormatException: For input string: "98597598684"
at java.lang.NumberFormatException.forInputString(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
这可能很简单,但这让我疯狂1小时,任何想法?