PHP code example of homevip / response

1. Go to this page and download the library: Download homevip/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/ */

    

homevip / response example snippets



    use ResponseJson;
    public function test(Request $request)
    {
        // 成功输出
        $success = [];
        return $this->outSuccess($success);


        // 错误输出
        $error = '非正常数值';
        return $this->outError(4100, $array); // 错误码, 错误其他信息[选填]
    }