我在服务器上编写了一个烧瓶应用程序.我像下面这样运行: -
export FLASK_APP=mypyhthonfile
nohup flask run --host=host-ip --port=port-number
Run Code Online (Sandbox Code Playgroud)
python脚本具有以下记录器语句:
Logger.info("this is a log")
Run Code Online (Sandbox Code Playgroud)
记录器语句同时打印在logger文件和nohup.out中
避免在nohup.out中打印记录器语句的方法是什么?
我必须使用PHP解析这个json数据并将值存储到PHP变量中.
{
"sender": "am@email.com",
"receiver": "ak@email.com",
"msg_id": "msg1_am@email.com",
"subject": "Group Discussion",
"references": ["msg1_aman@email.com","msg1_s@email.com","msg1_v@email.com"]
}
Run Code Online (Sandbox Code Playgroud)
我正在使用这个PHP代码,它无法正常工作; 请检查一下.
对于字段'sender','receiver','msg_id'和'subject,我正在使用PHP变量'$ msg_id','$ sender','$ receiver'和'$ subject'.
我试图在数组'ref_id'中存储'references'的数据.
此外,文件'dataset_f.json'具有以下方式的内容:
{ "sender":"aman@email.com","receiver":"akash@email.com","msg_id":"msg1_aman@email.com","subject": "Project Discussion","references":["msg1_aman@email.com","msg1_s@email.com","msg1_v@email.com"]}
{ "sender":"akash@email.com","receiver":"aman@email.com","msg_id":"msg1_akash@email.com","subject": "Project Discussion","references":["msg1_aman@email.com","msg1_s@email.com","msg1_v@email.com"]}
Run Code Online (Sandbox Code Playgroud)
这就是为什么php代码逐行读取文件
<?php
$h1 = fopen("dataset_f.json", "r");
while(!feof($h1)){
$line = fgets($h1);
$test_case = json_decode($line);
$ref_id = array();
$msg_id = $test_case->{'msg_id'};
$sender = $test_case->{'sender'};
$receiver = $test_case->{'receiver'};
$subject = $test_case->{'subject'};
foreach($test_case as $val)
{
foreach($val -> references as $refer)
{
array_push($ref_id, $refer->ref);
}
}
// printing the values
$arrlen=count($ref_id);
for($x=0;$x<$arrlen;$x++)
{ …Run Code Online (Sandbox Code Playgroud)