• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I replace front-end views with JSONs in Codeigniter 3?

#9
Quote:Great. It works as desired. 

How can I make the json pretty, from the controller?


https://www.php.net/manual/en/function.json-encode.php
PHP Code:
public function index() {
   $data['something'] = 'whatever is appropriate';
   $this->output->set_content_type('application/json')->set_output(json_encode($data,JSON_PRETTY_PRINT));

Reply


Messages In This Thread
RE: How do I replace front-end views with JSONs in Codeigniter 3? - by ciadmin - 08-22-2019, 01:47 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.