Yii2?? ??? activeRecord(AR)? ???? ??? ?? ?????.
(?? ?? ??: yii)
1. Model
models? mvc? ???? ???? ???, ?? ? ??? ?????. ??. Model ???? Active Record? ?? ?? ??? ?? ?????? ???. ????? ??? yiibaseModel?? ?? ?????.
namespace app\models; use yii\base\Model; class LoginForm extends Model { public $username; public $password; public function rules() { // 這里寫(xiě)你的驗(yàn)證規(guī)則 [['username', 'password'], 'required'], // password is validated by validatePassword() ['password', 'checkPassword'], // 驗(yàn)證密碼 } // 這里寫(xiě)你驗(yàn)證密碼的邏輯 public function checkPassword($attribute,$params) { // ...... } // 這里寫(xiě)登錄的邏輯 public function login() { // ...... } }???? ??? ???????.
namespace app\controllers; use Yii; use yii\web\Controller; class SiteController extends Controller { // ... public function actionLogin() { $model = new LoginForm(); // 根據(jù)用戶在登錄表單的輸入來(lái)做判斷 if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } } }2. ActiveRecord ??? Active Record(Active Record, ?? AR)? ??????? ???? ??? ? ?? ?? ?? ?????? ?????. activeRecord ???? ??? ???? ???? ????. ? activeRecord ??? ???? ?? ???? ??? ??(?, AR? ?? ??)? ??? ?? ?? ?? ?????. ?? ??(AR ??)? ??? ???? ?? ???? AR ??? ??? ?? ?? ?? ?????. 3. Model? ActiveRecord ???? ??yiidbActiveRecord.php?? ? ? ??
class ActiveRecord extends BaseActiveRecord { ... }yiidbBaseActiveRecord.php?? ? ? ??
abstract BaseActiveRecord extends Model implements ActiveRecordInterface { ... }
? ??? yii2? model? activeRecord? ???? ?????? ?? ?????. ??? ??? 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)

TO TOREABASICROUTEINYII, FIRSTEPACONTROLLERBYPLACINGITINTECONTROLLERSDIRECTORYWITHPROPENAMINAMINAMINAMINAMINAMINATDEFINITIONEPTENDENDINGYII \ WEB \ CONTROLLER.1) CREATEANCACTIONSTATRINGWITH "ACTION"

Ayiideveloper'skeyErsponsibilitiesIngindingandimplementingFeatures, ApplicationSecurity, ? ??? ? ??? ???? QualificationSneedeDareastronggraspofpp, Experience-EndTechnologies, DatabasemanagementsKills ? Problem-Solvingabi

YII?? ??? ?? ??? ???? ??? ????? ???? ???? ???? ???? ???? ????? ?? ??? ???? ????. ?? ?? ??? ?? ???? ????? ?? ?????? JSON? ??????. ????? ??? ??? ?? ??? ?????. ?? ???? ??? ?????. 1. ???? ???? ????. 2. ??? ????? ??????. 3. URL ?? ????? ? ????. 4. ?? ??, ??? ?? ??, ???? ?? ?? ???? ???; 5. AccessControl ?? ?? ?? ??? ???? ???? ??????. ?? ??, ActionProfile ($ id)? /site /profile? id = 123? ?? ????? ??? ??? ???? ??? ? ? ????. ?? ??????

ayiidevelopercraftswebapplicationsingtheyiiiframework, ?? ?? Killsinphp, yii-specificknowledge ? webdevelopmentlifecyclemanagement.keySponsibilitiesInclude : 1) WritingEfficientCodetOptimizeperFormance, 2) poploitizingsecurityTopectAppplications,

touseactivercordinyifeffectively, ??? ??? ??? createamodelclassforeachtableandinteractwiththeabaseusingobject-orientedmethods.first, defineamodelclasseptendingyii \ db \ activerecordandspecorrecorrespecorrespectecorrespectedtablenaMeAblename ()

?? ??? ????, ?? ??? ??? ?????, ?????? ??? ????, ??? ??? ???? ????? YII?? ?? ???? ?? ? ? ????. ?? ??? ??? ????. 1. filetarget ?? dbtarget? ?? ?? ???? ?? ?? ??? ???? ??? '??'?? ?????. 2. yii :: info () ?? yii :: ?? ()? ???? ??? ???? ??? ????? (? : ??? ?? ? ???? ???)? ??? ?; 3. ????? ?? ? ??? ?? ??????? ??? ???? ?? ???? ???? ?? ??? ?? ??? ???????. 4. ???? ??? ?? ? ? ?? ?? ??? ?? ??? ???? ???? ??? ???? ??? ???? IP ? ??? ??? ?? ? ? ????. 5

YII? AssetBundles? ???? ?? CSS ? JS ??? ???? ?? ?????. PHP ???? ?? ?? ??? ??? ???? ???? ???, ?? ? ??? ?????. 1. ??? ???? CSS, JS ? ?? ???? ???? ???? ???? ? ???? PHP ??????. 2. ? ?? ????? ??? ???? ???? HTML ??? ???? ?????. 3. ??? ?? ?? ??? ??? ?? ?? ??? ???? ??? ?? ? ? ????. 4. ??? ??? ????? ?/CSS ? ?/JS? ???? ??? ??? ?? ? ? ????. 5. AssetManager ??? ???? ?? ???? ???? ?? ??? ???? ???? ?? ??? ??????. ?? ???? ???? ???? ???? ?? ??? ? ?? ???? ???? ? ????.

YII?? ????? ??? ??, ??? ?? ? ??? ?? ???? ?? ???? ??? ?????. ????? ?? ???? ??? ?????. ① http ?? ??; data ???? ??? ???? ?? ??? ?? ?????. dase ???? ???? ??? ?? ?????. processing ?? ?? ??; HTML, JSON ?? ???? ?? ??. YII ????? ????? yii \ web \ ?????? ???? ? ?? ???? URL? ?? ??? ? ??? ??? ?????. ?? ??, http://example.com/site/index? ???? sitecontroller? actionIndex () ???? ?????. ???? ???? ?? ??, ?? ?? ? ???? ?????.
