JSON Javascript AJAX jQuery HTML PHP Example MORE

How to read JSON file in PHP


Get the content of the JSON file using file_get_contents():

$str = file_get_contents ('http://example.com/example.json/');

Now decode the JSON using json_decode():

Advantages of Using Bootstrap

Bootstrap have many more advantages:

  • Save lots of time — Need to remember the class name only.
  • Responsive features — Lot’s of responsive features in bootstrap.
  • Consistent design
  • Easy to use
  • Compatible with browsers : It’s Compatible with all browsers including chrome, safari, mozilla etc.
  • Open Source- It is open source means free to use.
  • Mobile friendly

Bootstrap 4 CDN

If you don’t want to download the bootstrap then you can put the below url in the head element of your html file to use bootstrap.

$json = json_decode($str, true); // decode the JSON into an associative array