?? ?? ?????? ????? CakePHP? ???? ?????. ?? ???? ?? ??? ????? ?? ??? ??? ???.
1??
??? ??? ???? ??????? ????.
2??
srcLocale ???? ??? ? ??? ?? ?? ????? ????. ?? ????? ??? ??? ? ?? ISO ????? en_US, fr_FR ?? ?? ?? ??? ??? ? ????.
3??
? ?? ?? ????? ??? default.po ??? ????. ? ???? ?? ????? ?? msgid ? msgstr ??? ??? ???? ????.
msgid "msg" msgstr "CakePHP Internationalization example."
??? msgid? ?? ??? ???? ??? ??? msgstr? ??? ???? ????.
4??
View ??? ???? ?? msgid? ??? ?? ??? ? ??? ?? ??? ??? ?? ?? ?????.
<?php echo __('msg'); ?>
?? ??? config/app.php ???? ?? ?? ???? ??? ? ????.
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US')
???? ??? ????? ?? ?? ??? ? ????.
use Cake\I18n\I18n; I18n::locale('de_DE');
?
?? ????? ?? config/routes.php ??? ?????.
config/routes.php
<?php use Cake\Http\Middleware\CsrfProtectionMiddleware; use Cake\Routing\Route\DashedRoute; use Cake\Routing\RouteBuilder; $routes->setRouteClass(DashedRoute::class); $routes->scope('/', function (RouteBuilder $builder) { $builder->registerMiddleware('csrf', new CsrfProtectionMiddleware([ 'httpOnly' => true, ])); $builder->applyMiddleware('csrf'); //$builder->connect('/pages', ['controller'=>'Pages','action'=>'display', 'home']); $builder->connect('locale', ['controller'=>'Localizations','action'=>'index']); $builder->fallbacks(); });
src/Controller/LocalizationsController.php?? LocalizationsController.php ??? ?????. ???? ??? ?? ??? ?????.
src/Controller/LocalizationsController.php
<?php namespace App\Controller; use App\Controller\AppController; use Cake\I18n\I18n; class LocalizationsController extends AppController { public function index() { if($this->request->is('post')) { $locale = $this->request->getData('locale'); I18n::setLocale($locale); } } } ?>
resourceslocales? locales ????? ????. locales ???? ??? en_US, fr_FR, de_DE?? ???? 3?? ????. default.po.?? ? ???? ??? ??? ????. ?? ??? ?? ??? ?????.
??/???/en_US/default.po
msgid "msg" msgstr "CakePHP Internationalization example."
??/???/fr_FR/default.po
msgid "msg" msgstr "Exemple CakePHP internationalisation."
??/???/de_DE/default.po
msgid "msg" msgstr "CakePHP Internationalisierung Beispiel."
src/Template? Localizations ????? ???? ?? ???? ??? index.php?? View ??? ?????. ?? ??? ?? ??? ????.
src/Template/Localizations/index.php
Form->create(NULL,array('url'=>'/locale')); echo $this->Form->radio("locale", [ ['value'=>'en_US','text'=>'CakePHP ???'], ['value'=>'de_DE','text'=>'German'], ['value'=>'fr_FR','text'=>'French'], ] ); echo $this->Form->button('Change Language'); echo $this->Form->end(); ?> <?php echo __('msg'); ?>
?? URL? ???? ?? ??? ??? ???. http://localhost/cakephp4/locale
??
???? ??? ?? ??? ?????.

???
CakePHP? ??? ?? ??? ???? ?? ??? ???? ?????. ?? ?????? ??? ??? ????? ?? ?? ?? ???? ??? ???? ???? ???.
use Cake\Mailer\Email;
Email ???? ??? ??? ???? ??? ???? ?????.
|
|||||||||
???? |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
?? |
|
||||||||
?? | ???? ?? ??? ???? ?????. ???? ?????
|
?? ??(string|array|null $emailnull, string|null $namenull) | |
???? |
|
---|---|
?? | ??|$this |
?? | ???? ???? ??? ????? |
???(???|??|null $contentnull) | |
???? |
|
---|---|
?? | ?? |
?? | ??? ???, ??? ? ????? ???? ??? ??? |
??(???|null $subjectnull) | |
???? |
|
---|---|
?? | ??|$this |
?? | ?? ????/?? |
Syntax | Attachments(string|array|null $attachmentsnull) |
---|---|
Parameters |
|
Returns | array|$this |
Description | Add attachments to the email message |
Syntax | Bcc(string|array|null $emailnull, string|null $namenull) |
---|---|
Parameters |
|
Returns | array|$this |
Description | Bcc |
Syntax | cc( string|array|null $emailnull , string|null $namenull ) |
---|---|
Parameters |
|
Returns | array|$this |
Description | Cc |
Example
Make changes in the config/routes.php file as shown in the following program.
config/routes.php
<?php use Cake\Http\Middleware\CsrfProtectionMiddleware; use Cake\Routing\Route\DashedRoute; use Cake\Routing\RouteBuilder; $routes->setRouteClass(DashedRoute::class); $routes->scope('/', function (RouteBuilder $builder) { $builder->registerMiddleware('csrf', new CsrfProtectionMiddleware([ 'httpOnly' => true, ])); $builder->applyMiddleware('csrf'); //$builder->connect('/pages',['controller'=>'Pages','action'=>'display', 'home']); $builder->connect('/email',['controller'=>'Emails','action'=>'index']); $builder->fallbacks(); });
Create an EmailsController.php file at src/Controller/EmailsController.php. Copy the following code in the controller file.
src/Controller/EmailsController.php
<?php namespace App\Controller; use App\Controller\AppController; use Cake\Mailer\Email; class EmailsController extends AppController{ public function index(){ $email = new Email('default'); $email->to('abc@gmail.com') ->subject('About') ->send('My message'); } } ?>
Create a directory Emails at src/Template and under that directory, create a View file called index.php. Copy the following code in that file.
src/Template/Emails/index.php
Email Sent.
Before we send any email, we need to configure it. In the below screenshot, you can see that there are two transports, default and Gmail. We have used Gmail transport.
You need to replace the “GMAIL USERNAME” with your Gmail username and “APP PASSWORD” with your applications password. You need to turn on 2-step verification in Gmail and create a new APP password to send email.
config/app.php

Execute the above example by visiting the following URL ? http://localhost/cakephp/email
Output
Upon execution, you will receive the following output.

? ??? CakePHP ???? ?? ?????. ??? ??? 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)

??? ??











tostaycurrentwithphpdevelopments ? bestpractices, followkeynewssources lifephp.netandphpweekly, adgytwithcommunitiesonforumsandconferences, readlingupdated andgrad indewfeatures, andreadorcontributetoopensourceproceprosts.first

phpbecamepupularforwebdevelopmentduetoiteofleneflening, whithhtml, wididepreadhostingsupport, andalargeecosystemincludingframeworkslikelaravelandcmsplatformsformslikewordpress.itexcelsinhandlingformsubmissions, managingussess, interptisussivers, ?? ???

TOSETTHERIGHTTIMEZONEINPHP, usedate_default_timezone_set () functionattStartOfyourscriptwitHavalidInlifiersuchas'America/new_york'.1.edate_default_timezone_set () beforeanydate/timeFunctions.2

TovalidateUserInputInphp, useBuilt-invalidationFunctions likefilter_var () ? filter_input (), applyRegulArexPessionSforCustomFormatsSuchasUsUserPhonEnumbers, CheckDatatypesFornumericValuesLikeAgeArPrice, setLtrimtsAnspacetReopeTopeTopeTopePeTopePeTopePeTopeTopeTopeTlyout

thephpfunctionserialize () andunserialize () areusedtoconvertcomplexDattoresintostorasandabackagain.1.serialize () c onvertsDatalikeCarraysorObjectSrayStringStringStrainingTainingTypeanDtuctureIncomation.2.

PHP ??? HTML ??? ???? ? ??? ??? ???? .php? ?? ??? ??? ???? ??? ???? ?? ?? ? ? ??? ??????. ?? ??? ???? PHP ??? ???? HTML? ?? ???? ?? ???? ??????. ?? ??? ???? PHP ? HTML? ?? ? ???? ??? ???? ?? ?? ??? ??? ? ????. ?? ???, ?? ?? ?? ?? ?? ? ?? ???? ?? ??? ??? ?? ?? ?? ? ?? ??????? ???????.

???? ???? ?? PHP ??? ???? ??? ??, ???? ??? ?? ??? ?? ??? ????. ??? ??? ???? ? ?????. 1. $ userData ? calculateToTalPrice ()? ?? ??? ??, ?? ? ??? ??? ??????. 2. PSR-12 ?? ?? ?? ???? ?????. 3. ??? ?? ?? ??? ???? MVC ?? Laravel ??? ????? ???? ??????. 4. ?? ??? ??? ??? ?? ???? ??? ?? ???? ????. 5. ? ???? ??? ???? ????? ??? ???? ?? ??, ?? ? ? ??? ??????. 6. ??? ??? ??, ??? ?? ??, ??? ?? ? ?? ??? ????. ??? ??? ?? ??, ?? ??? ? ?? ?? ? ???? ??????.

?, youcanrunsqlqueriesusingphp, andtheprocessinvolveschoingadatabaseexextension, executequeriessafely, andclosingconnectionswhendone.todothis, firstchoosebetween -mysqliorpdo, withpdobeingmoreflectibleblyblyblyblyblyblyblyblyblyblyblyblyblyblyblybledingmuttitatabas
