-
Notifications
You must be signed in to change notification settings - Fork 0
PHP Laravel入門(Code Data)
edwardyi edited this page Sep 22, 2018
·
2 revisions
- storage:編譯後產生的檔案、log檔案,設定為可以寫入的權限
- bootstrap:框架啟動加載的檔案
- cache:加載後產生的檔案
- vendor:composer命令模組
- app:系統核心代碼
- chmod -R 777 storage
- chmod -R 777 bootstrap/cache
- symfony console元件為基礎架構
- php artisan list
- php artisan --version
- php artisan make:command SendEmails
- php artisan make:controller CustomerController
- 與客戶端互動
- 用routes/web.php定義web相關的routes
- 用routes/api.php定義api相關的routes
- get/post/delete/put
- 符合所有any
- 符合一部分match
- url helper透過url()轉向
- 建立了一個對象,在中間不斷地去改變它
- 用::訪問某個function,無論是否為static,__construct()都不會被調用
- Builder對象不能直接存取Article對象,需要轉成終結對象,才能調用到裡面的屬性
- 一對一:不需要中間表
- 多對多:用take優化性能
- 一個網頁一個PHP:使用漏洞攻擊(MVC)
- 缺乏統一寫法:一個人離開要了解寫法(Framework)
- 每次都從頭開始:開發效率低(不用重新造輪子)
- 由開發者決定是否要用方法
- codeIgniter:支援最廣(適合接案使用)
- laravel:全功能(學習門檻高,底層用symfony)
- slim:簡約(restful API使用)
- phalcon:快速(C語言開發)
- 用最新的PHP新功能
- 用罕見的Extension
- composer:安裝套件
- artisan:cli tool
- 把商業邏輯無關又常常用到的功能抽出來
- 套件為主的開發方式,名稱衝突問題(NameSpace)
- ORM:SQL物件化
- Migration:欄位開錯,版本控管
- TDD:先寫測試在寫開發
- 對Spec更加了解
- 不用擔心重構的問題
- 提早發現架構的問題
- https://oomusou.io/laravel/laravel-for-newbie/
- https://lvwenhan.com/laravel/421.html(Eloqent)
- https://lvwenhan.com/laravel/422.html(中間流)
- https://lvwenhan.com/laravel/423.html(模型關係)
- https://github.com/johnlui/Learn-Laravel-4
- https://github.com/johnlui/Learn-Laravel-5/issues/16
- https://www.jianshu.com/p/b0900bed6de8
- https://gist.github.com/hootlex/da59b91c628a6688ceb1(run locally)
- http://www.codedata.com.tw/uncategorized/php-laravel-dev-tutorial-2-class-configuration-structure/
- http://www.codedata.com.tw/uncategorized/php-laravel-dev-tutorial-3-class-artisan/
- http://www.codedata.com.tw/uncategorized/php-laravel-dev-tutorial-4-class-routes/
- https://medium.com/@shengyou/2018ironman-eos-for-php-developer-day14-4c5424fc7232(30天鐵人)