-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbucket_buy.php
More file actions
32 lines (29 loc) · 938 Bytes
/
Copy pathbucket_buy.php
File metadata and controls
32 lines (29 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$id = $_POST["id"];
$my_file = fopen("./data/person/" . $id . ".json", "r");
$arr = array();
while (!feof($my_file)) {
$my_line = fgets($my_file);
$obj = json_decode($my_line);
if ($obj != "") {
array_push($arr, $obj->id);
}
}
fclose($my_file);
$my_file = fopen("./data/post.json", "r");
$result = "";
while (!feof($my_file)) {
$my_line = fgets($my_file);
$obj = json_decode($my_line);
if ($obj != "") {
for ($i = 0; $i < count($arr); $i++) {
if (strcmp($obj->id, $arr[$i]) == 0) {
$result .= '<section><img id="grape" class="img" src="./img/' . $obj->img . '" alt="사진">';
$result .= '<div><h3>' . $obj->title . '</h3><br><br>';
$result .= '<p>1kg당 ' . $obj->prize . '원<br>' . $obj->kg . 'kg 단위부터 판매 중</p></div></section>';
}
}
}
}
echo $result;
?>