src/SmartFactory/JsonApiRequestManager.php
public function sendJsonResponse(&$response_data, $headers = [])
    {
        header('Content-type: application/json');
        
        if (!empty($headers)) {
            if (is_array($headers)) {
                foreach ($headers as $header) {
                    header($header);
                }
            }
        }
        
        echo array_to_json($response_data);
    }
public function sendJsonResponse(&$response_data, $headers = [])
    {
        header('Content-type: application/json');
        
        if (!empty($headers)) {
            if (is_array($headers)) {
                foreach ($headers as $header) {
                    header($header);
                }
            }
        }
        
        echo array_to_json($response_data);
    }
public function sendJsonResponse ( & $ response_data , $ headers = [ ] ) { header ( 'Content-type: application/json' ) ; if ( ! empty ( $ headers ) ) { if ( is_array ( $ headers ) ) { foreach ( $ headers as $ header ) { header ( $ header ) ; } } } echo array_to_json ( $ response_data ) ; }
This is an auxiliary function for sending the response in JSON
format.

@param array $response_data
The array with response data.

@param array $headers
The array of additional headers if necessary. The header
'Content-type: application/json' is sent automatically
and need not be listed explicitly.

@return void

@author Oleg Schildt
This is an auxiliary function for sending the response in JSON format .