PHP code example of mjy191 / my-curl
1. Go to this page and download the library: Download mjy191/my-curl 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/ */
mjy191 / my-curl example snippets
namespace App\Exceptions;
use Mjy191\Tools\Tools;
use Exception;
class ApiException extends Exception
{
/**
* 转换异常为 HTTP 响应
*
* @param \Illuminate\Http\Request
* @return \Illuminate\Http\Response
*/
public function render($request)
{
return response()->json(Tools::returnData(null,$this->getCode(),$this->getMessage()))->setEncodingOptions(JSON_UNESCAPED_UNICODE);
}
}