PHP code example of houdunwang / response

1. Go to this page and download the library: Download houdunwang/response library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

houdunwang / response example snippets


public function ajax( $data, $type = "JSON" ) 
type指返回数据类型包括:TEXT XML JSON 默认为JSON

$data=['name'=>'后盾网','url'=>'houdunwang.com']
echo Response::ajax($data,'xml');

$data=['name'=>'后盾网','url'=>'houdunwang.com']
echo ajax($data);