The Definitive Guide to Yii 2.0 Qiang Xue, Alexander Makarov, Carsten Brandt, Kl

The Definitive Guide to Yii 2.0 Qiang Xue, Alexander Makarov, Carsten Brandt, Klimov Paul and the Yii community Copyright 2014 Yii Software LLC. Contents 1 Introduction 1 1.1 What is Yii . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Upgrading from Version 1.1 . . . . . . . . . . . . . . . . . . . 2 2 Getting Started 15 2.1 Installing Yii . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.2 Running Applications . . . . . . . . . . . . . . . . . . . . . . 20 2.3 Saying Hello . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.4 Working with Forms . . . . . . . . . . . . . . . . . . . . . . . 27 2.5 Working with Databases . . . . . . . . . . . . . . . . . . . . . 33 2.6 Generating Code with Gii . . . . . . . . . . . . . . . . . . . . 39 2.7 Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3 Application Structure 47 3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.2 Entry Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.3 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 3.4 Application Components . . . . . . . . . . . . . . . . . . . . . 62 3.5 Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 3.6 Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 3.7 Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 3.8 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 3.9 Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 3.10 Widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 3.11 Assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 3.12 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 4 Handling Requests 143 4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 4.2 Bootstrapping . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 4.3 Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 4.4 Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 4.5 Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 iii iv CONTENTS 4.6 URL Management . . . . . . . . . . . . . . . . . . . . . . . . 158 4.7 Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . 165 4.8 Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 5 Key Concepts 171 5.1 Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 5.2 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 5.3 Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 5.4 Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 5.5 Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . 187 5.6 Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 5.7 Class Autoloading . . . . . . . . . . . . . . . . . . . . . . . . 195 5.8 Service Locator . . . . . . . . . . . . . . . . . . . . . . . . . . 197 5.9 Dependency Injection Container . . . . . . . . . . . . . . . . . 199 6 Working with Databases 207 6.1 Database basics . . . . . . . . . . . . . . . . . . . . . . . . . . 207 6.2 Query Builder and Query . . . . . . . . . . . . . . . . . . . . 217 6.3 Active Record . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 6.4 Database Migration . . . . . . . . . . . . . . . . . . . . . . . . 246 7 Getting Data from Users 259 7.1 Working with Forms . . . . . . . . . . . . . . . . . . . . . . . 259 7.2 Validating Input . . . . . . . . . . . . . . . . . . . . . . . . . 263 7.3 Uploading Files . . . . . . . . . . . . . . . . . . . . . . . . . . 276 8 Displaying Data 283 8.1 Data Formatter . . . . . . . . . . . . . . . . . . . . . . . . . . 283 8.2 Data providers . . . . . . . . . . . . . . . . . . . . . . . . . . 289 8.3 Data widgets . . . . . . . . . . uploads/S4/ yii2-guide.pdf

  • 29
  • 0
  • 0
Afficher les détails des licences
Licence et utilisation
Gratuit pour un usage personnel Attribution requise
Partager
  • Détails
  • Publié le Jul 11, 2022
  • Catégorie Law / Droit
  • Langue French
  • Taille du fichier 3.8293MB