这是我的php,country_img是图片属性
if($postjson['aksi'] == 'get_negara'){
$data = array();
$query = mysqli_query($mysqli, "SELECT * FROM countries ORDER BY id ASC");
while($row = mysqli_fetch_array($query)){
$data[] = array(
'id' => $row['id'],
'country_name' => $row['country_name'],
'country_img' => $row['country_img'],
);
}
if($query) $result = json_encode(array('success'=>true, 'result'=>$data));
else $result = json_encode(array('success'=>false));
echo $result;
}
这是我的国家。html
<ion-card *ngFor="let detail of details">
<ion-item >
<img src= "data:image/jpg;base64,{{detail.country_img}}" />
<h2>{{ detail.country_name }}</h2>
<ion-icon name="arrow-forward" item-right (click)="showdata(detail.id)"></ion-icon>
</ion-item>
</ion-card>
这是我的国家。ts
loadcountry(){
let body = {
aksi: 'get_negara'
};
this.postPvdr.postData(body, 'aksi_negara.php').subscribe(data => {
for(let detail of data.result){
this.details.push(detail);
console.log(data);
}
});
}