Answer the question
In order to leave comments, you need to log in
How to generate a list of products from JSON and display it on a page using PHP?
There is a JSON file from which you need to generate a list of products using PHP :
{
"product": [
{
"name": "Капуста",
"img": "http://pngimg.com/uploads/cabbage/cabbage_PNG8798.png",
"price": "22"
},
{
"name": "Капуста",
"img": "http://pngimg.com/uploads/cabbage/cabbage_PNG8798.png",
"price": "22"
},
{
"name": "Капуста",
"img": "http://pngimg.com/uploads/cabbage/cabbage_PNG8798.png",
"price": "22"
},
{
"name": "Капуста",
"img": "http://pngimg.com/uploads/cabbage/cabbage_PNG8798.png",
"price": "22"
}
]
}
Answer the question
In order to leave comments, you need to log in
<?php
$file = json_decode(file_get_contents("file.json"));
echo $file -> product[0] -> name;
A fantastic option is to learn PHP, HTML and CSS, write everything yourself.
A realistic option is to order freelance development.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question