Laravel ???? ??: ?????? ??? ??
Mar 06, 2024 pm 04:48 PMLaravel?? ??? ?????? ?? ?????? ???? ????? ??? ?????. ?? ???? ????? ??? ??? ???? ??, ??? ??? ??? ???? ???? ??? ??????? ???? ??? ???? ?? ? ?????. Laravel? ???? ??? ?????? ???? ? ??? ?? ??? ??? ??? ?????. ? ????? ? ?? ??? ??? ???? ?? ?? ??? ?????.
1. ?? ??
??? ??? ?????? ??? ?? ? ?????. Laravel?? ??? ?? ???? ???? ??? ???? ??? ?? ?? ??? ?? ??? ????? ? ????. ?? ??? ???? ?? Laravel?? ???? Log ???? ??? ? ????. ?:
use IlluminateSupportFacadesLog; try { // 可能會拋出異常的代碼塊 } catch (Exception $e) { Log::error('出現(xiàn)異常:' . $e->getMessage()); }
?? ?? ???? try ??? ??? ??? ???? Log ???? ???? ?????. ?? ??. ???? ??? ?? ?? ??? ???? ??, ?????? ? ??? ?? ??? ??? ??? ? ????.
2. ???? ?? ??
?? ??? ???? ??? ???? ??????? ?? ??? ????? ????? ?? ????. Laravel? Sentry, Bugsnag ?? ?? ?? ?? ???? ?????. ??? ??? ???? ??? ???? ?? ???? ? ??? ? ? ????. ??? ??? ?????? ?? Sentry? ???? ????:
?? Sentry ?? ???? ?????:
composer require sentry/sentry-laravel
?? ?? Laravel? ?? ???? DSN? ?????:
SENTRY_LARAVEL_DSN=https://your-sentry-dsn
???? AppExceptionsHandler.php? ?? ??? ?????:
public function report(Exception $exception) { if ($this->shouldReport($exception)) { app('sentry')->captureException($exception); } parent::report($exception); }
? ??? ??? ???? ???? Sentry? ?? ??? ?????. ???? Sentry? ???? ??? ?? ??, ?? ?? ?? ? ? ????.
3. ??? ??? ?????
??? ???? ???? ??? ???? ? ??? ??? ??? ?? ????? ??????? ?? ??? ??? ?? ????. Laravel? ??? ?? ??? ????, ???? ?????? ??? ??? ?? ???? ?? ??? ??? ?? ? ????. ??? ??? ??? ?? ????.
?? .env ???? ??? ??? ?????:
MAIL_MAILER=smtp MAIL_HOST=your-smtp-host MAIL_PORT=587 MAIL_USERNAME=your-smtp-username MAIL_PASSWORD=your-smtp-password MAIL_ENCRYPTION=tls
?? ?? AppExceptionsHandler.php? ?? ??? ?????.
public function report(Exception $exception) { if ($this->shouldReport($exception)) { $email = 'your-email@example.com'; $subject = '應(yīng)用發(fā)生錯誤'; $message = '錯誤信息:' . $exception->getMessage(); Mail::raw($message, function($email) use ($email, $subject) { $email->to($email)->subject($subject); }); } parent::report($exception); }
? ??? ??? ??? ????. ??? ??? ??? ??? ??????. ???? ??? ?? ???? ??? ???? ??? ? ????.
??
??, ???? ?? ? ??? ??? ???? Laravel ??????? ??? ? ? ?????? ??? ??? ???? ?? ??? ?? ? ????. ?????? ???? ???? ??????. ?? ?? ????????? ?? ??? ??? ???? ?? ???? ????? ?? ???? ??????? ?? ??? ?? ??? ??? ? ????.
? ??? Laravel ???? ??: ?????? ??? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PHP?? ?? ??? ???? ? ?? ?? ??? ????. 1. php.ini? ?? ??? ??; 2. ? ?? (? : Apache? Setenv ?? nginx? FastCGI_Param)? ??????. 3. PHP ?????? putenv () ??? ??????. ? ??? Php.ini? ????? ??? ???? ??? ???? ? ?? ??? ?? ???? ????? ???? Putenv ()? ?? ??? ?????. ?? ???? ?? ?? (? : php.ini ?? ? ?? ??)? ???? ????. ?? ?? ??? ??? ?? ??? ????? ???? ?? ????.

Laravel? ?? ??? ?? ?? ??? ?? ?? ??? ???? ??? ??????. ?? ???? ?? ??? ????? ? ???? I/O ?? ? ?? ?? ??? ???? ???? ??? ?? ? ????. 1. ?? ????? ?? ? ? ???????? ??? ????? ?? ???? ??????. 2. ??? ? ??? ?? ? ? PhPartisAnconfig? ?? ???????. 3. ?? ??? ??? ??? ???? ?? ?? ?? ???? ???? ????. 4. ?? ?? ??? ???? ?? ??? ??? .env ??? ???? ?? ???????.

PHP ????? ?? ??? ??? ? ??? ??? CI (Continuous Integration) ????? ???? ? ????. 1. DockerFile? ???? ?? ???, ?? ??, ??? ?? ? ?? ??? ???? PHP ??? ?????. 2. Gitlabci? ?? CI/CD ??? ???? .gitlab-ci.yml ??? ?? ??, ??? ? ?? ??? ???? ?? ??, ??? ? ??? ?????. 3. PHPUNIT? ?? ??? ??? ??? ???? ?? ?? ? ???? ???? ????????. 4. Kubernetes? ?? ?? ?? ??? ???? ?? .yaml ??? ?? ?? ??? ?????. 5. Dockerfile ??? ? ??? ??? ??????

Laravel? eloquentscopes? ?? ??? ??? ??? ?????? ?? ?? ??? ????? ?????. 1. ?? ??? ???? ???? ???? ???? Post :: published (); 2. ??? ??? ?? ??? ???? ???? ?? ??? ?? ?? ?? ??? ???? ???? ??? ?????? ??? ???? ???????. 3. ????? ?? ?? ?? ??? ??? ?? ?? ??? ?? ? ? ??? ?? ? ? ?? ?? ??? ?????. 4. ?? ??? ? ??? ?? ???? ? ??? ? ?? ??, ?? ??, ?? ???? ? ?? ?????????.

CreateAhelpers.phpfileInapp/helperswithCustOmFunctionsikeFormatPrice, isactiveroute, andisAdmin.2.addTheFileTothe "??"sectionOfcomposer.jsonUnderAutoLoad.3.runcomposerDump-AUTOLOADTOMAKETHINGTICTIONSGLOBELYAVAILABLE.4.USETHEHELPERFUNCUNTION

?? ?? ?? : ?? ????? PHP? ?? Error_Log ()? ??? ? ????. ????? ???? ??? ?? ??? ?????? ???? ?? ??? ? ?? ??? ???? ??? ?? ???, ??, ?? ? ?? ? ?? ?? ??? ???? ??? ??????. 2. ??? ?? ?? : ??? ??? ??? ??? ? ??? ?? ??? ??? ?? ??? ??? ??????? ??????. MySQL/PostgreSQL? ???? ??? ? ???? ??????. Elasticsearch Kibana? ? ???/? ???? ?????. ???, ??? ?? ? ??? ? ?? ??? ?? ??????. 3. ?? ? ?? ????? : ??, ???, ?? ? ??? ??? ??????. Kibana? ?? ????? PHP ??? ?? ?? ?????? ???? ???? ?????? ???? ??? ? ?? ??? ??? ? ????.

USEMOCKERYFORCUSTOMDENCENTICESBYSETEXPINTIONSWITHSHOULDRECEIVE ()

??, ??, ?? ?? ? ?? ??? ???? ?? ??? ?? ? ?? ???? ?????. 2. ?? ???? ???? ?? ??? ??? SONGSTOMONY ? HASMANY ?? ??; 3. ?? ? ? ?? ? ?? ??? ????? (?? ???? ?? ??? ? ??). 4. ?? ? ?? ??? ???? ?? ??? ???? ?? ? ?? ??? ???? ?? ??? ?????. 5. ?? ???? ??? ?? (?? ??)? ???? ?? ????? ??????. 6. ?? ??? ?? ??? ???? Laravel Signature URL? ???? ??? ??????. 7. ? ?? ?? ? ? ?? ??? ?? ?? ??? ?? ??? ?????. ?????? ??, ?? ?? ??? ??????????.
