common.php 874 Bytes
<?php

 function  jsonSucc($code="",$message="",$info=null,$total_count=null,$total_page=null,$current_page=null) {
    	 header('Content-Type:application/json; charset=utf-8');
    	if($info){
	        $data['code']   =   200;
	        $data['message'] =   $message;
	        $data['data']    =   $info;
             if($total_count || is_array($total_count) ){
                    $data['total_count']    =   $total_count;
                }
             if($total_page || is_array($total_page) ){
                    $data['total_page']    =   $total_page;
                }
             if($current_page || is_array($current_page) ){
                    $data['current_page']    =   $current_page;
                }
        }else{
	        $data['code']   =   $code;
	        $data['message'] =   $message;
        }
        echo   json_encode($data);
        exit;
    }