M
M
Mark2018-05-18 11:46:45
PHP
Mark, 2018-05-18 11:46:45

How to insert contents of json file into html or php page?

Hello, how can I insert the contents of a json file into a html or php page? To content

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SteepZero, 2018-05-18
@SteepZero

Well, depending on how you get this content
, for example, in the root of the site you have file.json
And you want to output html to the browser with the content from file.json through a php script
Then like this:

<?php
$content = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/file.json');

echo $contents;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question