??!
PHP ??? require
??? ??????? ???? ?? ? ?? ??? ? ?????? ?????. ??? 50? ??? require
?? ?????! PSR-4 ?? ??? ? ??? ??? ????? ???????.
PSR-4 ??(5?)
PSR-4? ??? ?? ?? ?????. ??? ???? GPS? ????? PSR-4? ??????? ???? ???? ????.
?? ??(2?)
-
???? ??? ??(FQCN):
VendorPackageClass
. ??? ?? ???? ?????. - ???? ??: ??????-???? ???? ? ??? ???? ????.
?? ??(10?)
???? ??:
<code>vendor/ └── jonesrussell/ └── blog/ ├── composer.json └── src/ └── Post/ ├── PostController.php └── PostRepository.php</code>
Composer ??(3?)
composer.json
:
{ "name": "jonesrussell/blog", "autoload": { "psr-4": { "JonesRussell\Blog\": "src/" } } }
?? ???(2?)
PostController.php
:
<?php namespace JonesRussell\Blog\Post; class PostController { public function index() { return ['status' => 'Ready to blog!']; } }
?? ??(5?)
?? ?????? ??:
{ "autoload": { "psr-4": { "JonesRussell\Blog\": "src/", "JonesRussell\Blog\Tests\": "tests/" } } }
??? ??????: (?? ??: src/Core/Database/Connection.php
)
<?php namespace JonesRussell\Blog\Core\Database; class Connection { private $config; public function __construct(array $config) { $this->config = $config; } }
????? ?(5?)
Laravel? Symfony? ????? PSR-4? ?????.
??? ?:
<?php namespace App\Http\Controllers; class BlogController extends Controller { public function index() { return view('blog.index'); } }
??? ?:
<?php namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; class BlogController extends AbstractController { public function index(): Response { return $this->render('blog/index.html.twig'); } }
?? ??(3?)
- "???? ?? ? ??" ??:
composer dump-autoload
? ?????. - ???? ?? ??: ???? ??? ??????? ????? ?????(???? ??!).
???(2?)
??? test-autoload.php
:
<?php require 'vendor/autoload.php'; $controller = new \JonesRussell\Blog\Post\PostController(); var_dump($controller->index()); // Should output "Ready to blog!"
?? ??
???? PSR-6(??)? ??????. ?? PSR ?? ???? ?????.
???
- PSR-4 ?? ??
- Composer ?? ?? ??
- ??? ?? ???(v0.3.0 - PSR-4 ??)
? ??? PHP? PSR ?? ?? ??? ?? ?????. ??? ??? 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. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled
