- PHP 7 Programming Blueprints
- Jose Palala Martin Helmich
- 183字
- 2021-07-08 11:14:09
Separation of Concerns
In a proper MVC architecture, we need to separate the view from the models that get our data, and the controllers will be responsible for handling business logic.
In our simple app, we will skip the controller layer since we just want to display the user profiles in one public facing page. The preceding function is also known as the template render part in an MVC architecture.
While there are frameworks available for PHP that use the MVC architecture out of the box, for now we can stick to what we have and make it work.
PHP frameworks can benefit a lot from the null coalesce operator. In some codes that I've worked with, we used to use the ternary operator a lot, but still had to add more checks to ensure a value was not falsy.
Furthermore, the ternary operator can get confusing, and takes some getting used to. The other alternative is to use the isSet
function. However, due to the nature of the isSet
function, some falsy values will be interpreted by PHP as being a set.
- The Android Game Developer's Handbook
- 機器學習系統:設計和實現
- PyTorch自動駕駛視覺感知算法實戰
- ASP.NET Core 2 and Vue.js
- Learn Programming in Python with Cody Jackson
- 大學計算機基礎(第2版)(微課版)
- Java 11 Cookbook
- 數據結構習題解析與實驗指導
- SQL Server數據庫管理與開發兵書
- C#程序設計(項目教學版)
- Building Slack Bots
- MySQL 8從零開始學(視頻教學版)
- Scratch從入門到精通
- ASP.NET Core 2 High Performance(Second Edition)
- R語言數據分析從入門到實戰