1. Go to this page and download the library: Download hectorqin/think-generate 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/ */
hectorqin / think-generate example snippets
namespace app\exception;
use Throwable;
use app\constants\ErrorCode;
class BusinessException extends \RuntimeException
{
/**
* 额外信息
*
* @var array|object
*/
protected $data;
public function __construct(int $code = 0, string $message = null, Throwable $previous = null)
{
if (!is_null($previous) && $previous instanceof static ) {
$code = $previous->getCode();
$message = $previous->getMessage() ?: null;
}
if (is_null($message)) {
$message = ErrorCode::$allCode[$code] ?? '';
}
parent::__construct($message, $code, $previous);
}