我一直在研究如何在php数组中打印新行。当我回音数据时,它是这样的:
Data Criação do Registo - 2014-12-23Bloco Operatório - TrueTipo de Internamento - UrgenteTipo de Internamento Cirurgia - com cirurgiaGlasgow Hospital - 15 (O-4 V-5 M-6)
我想让它看起来像这样,但我似乎找不到办法去做。
Data Criação do Registo - 2014-12-23
Bloco Operatório - True
Tipo de Internamento - Urgente
Tipo de Internamento Cirurgia - com cirurgia
Glasgow Hospital - 15 (O-4 V-5 M-6)这是我的密码:
$query1 = "SELECT TO_CHAR(DATACRIACAO,'YYYY-MM-DD') AS DATACRIACAO, NPROCESSO, BLOCOOPERATORIO, TIPOINTERNAMENTO, TIPOINTERNAMENTOCIRURGIA, GLASGOW_HOSPITAL
FROM PATIENT_TIMELINE_ADMISSAO WHERE NPROCESSO =629844";
$result1 = oci_parse($connect, $query1);
oci_execute($result1);
while($res1 = oci_fetch_array($result1)) {
$infotimeline['description']= 'Data Criação do Registo - '.$res1['DATACRIACAO'].
'Bloco Operatório - '.$res1['BLOCOOPERATORIO'].'Tipo de Internamento - '.$res1['TIPOINTERNAMENTO'].
'Tipo de Internamento Cirurgia - '.$res1['TIPOINTERNAMENTOCIRURGIA'].
'Glasgow Hospital - '.$res1['GLASGOW_HOSPITAL'];
}
$data = str_replace(array('[', ']','{','}'), '', htmlspecialchars(json_encode($infotimeline), ENT_NOQUOTES));
echo $data;编辑:我还添加了这段代码在pptimeline.php文件中,并将其作为头header('Content-Type: application/json');生成为json文件。然后信息被打印在我的basic.php文件中,它在<!DOCTYPE html>顶部有这个。
我还会添加完整的代码,以防有帮助- pptimeline时间线和basic.php
发布于 2015-04-05 19:03:20
如果有人遇到类似的问题,我就是这样解决的。我重新编写了代码,并以某种方式打印了这样的新行。
$query1 = "SELECT TO_CHAR(DATACRIACAO,'YYYY-MM-DD') AS DATACRIACAO, NPROCESSO, BLOCOOPERATORIO, TIPOINTERNAMENTO, TIPOINTERNAMENTOCIRURGIA, GLASGOW_HOSPITAL
FROM PATIENT_TIMELINE_ADMISSAO WHERE NPROCESSO =".$nprocesso."";
$result1 = oci_parse($connect, $query1);
oci_execute($result1);
while($infotimeline = oci_fetch_array($result1))
{
$timel[] = $infotimeline;
}
foreach ($timel as $infotimeline){
$data =
'"id":"pptimeline"'.','.
'"title":"Pervasive Patient Timeline - Doente nº '.$infotimeline["NPROCESSO"].'"'.','.
'"description":"'.'<p>'.'Data Criação do Registo - '.$infotimeline["DATACRIACAO"].'</p>'.
'<p>'.'Bloco Operatório - '.$infotimeline['BLOCOOPERATORIO'].'</p>'.
'<p>'.'Tipo de Internamento Cirurgia - '.$infotimeline['TIPOINTERNAMENTOCIRURGIA'].'</p>'.
'<p>'.'Glasgow Hospital - '.$infotimeline['GLASGOW_HOSPITAL'].'</p>'.'"'.','.
'"focus_date":"2015-02-20"'.','.
'"initial_zoom":10'
;
}
echo $data; 发布于 2015-03-30 19:27:36
试试下面的代码行:
while($res1 = oci_fetch_array($result1)) {
$infotimeline['description'] = 'Data Criação do Registo - '.$res1['DATACRIACAO']. '<br/>'.
'Bloco Operatório - '.$res1['BLOCOOPERATORIO'].'Tipo de Internamento - '.$res1['TIPOINTERNAMENTO'].'<br/>'.
'Tipo de Internamento Cirurgia - '.$res1['TIPOINTERNAMENTOCIRURGIA'].'<br/>'.
'Glasgow Hospital - '.$res1['GLASGOW_HOSPITAL'];
}
$data = str_replace(array('[', ']','{','}'), '', htmlspecialchars(json_encode($infotimeline), ENT_NOQUOTES));
echo $data;发布于 2015-03-30 19:52:02
要打印出的每一行之间的用户<br>:即。
'Data Criação do Registo - '.$res1['DATACRIACAO'].
'<br>Bloco Operatório - '.$res1['BLOCOOPERATORIO'].'<br>Tipo de Internamento - '.$res1['TIPOINTERNAMENTO'].
'<br>Tipo de Internamento Cirurgia - '.$res1['TIPOINTERNAMENTOCIRURGIA'].
'<br>Glasgow Hospital - '.$res1['GLASGOW_HOSPITAL'];https://stackoverflow.com/questions/29354475
复制相似问题