- https://framework.zend.com/manual/1.12/en/learning.quickstart.html
- https://framework.zend.com/manual/1.12/en/learning.html
- Tải library của zend về và cài đặt path global (windows) C:\wamp64\www\zend\ZendFramework-1.12.18\bin
- Chạy lệnh
zf
để kiểm tra cài đặt thành công. - Chạy
zf create project ten_project
để tạo một project mới.
application/configs/application.ini
Cài đặt kết nối db:
resources.db.adapter = "PDO_MYSQL"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "*****"
resources.db.params.dbname = "db_name"
resources.db.driver_options.charset = "utf-8"
resources.db.isDefaultTableAdapter = true
Zend Tools:
zf configure db-adapter dsn section-name[=production]
zf configure db-adapter dsn section-name[=development : production] \
> 'adapter=PDO_MYSQL&dbname=APPLICATION_PATH "/../data/db/guestbook.db"' \
> development : production
zf create action sign Guestbook
Tạc Action cho controller:
zf Create Action name controller-name[=Guestbook] view-included[=1] module
Lệnh tạo controller:
zf create controller Guestbook index-action-included[=1]
View Helper: https://framework.zend.com/manual/1.12/en/zend.view.helpers.html#zend.view.helpers.initial.doctype
- Workflow của Zend
- Request HTTP -> htaccess -> index.php -> load "Zend/Application.php" -> load config "application.ini" -> từ config sẽ load "Bootstrap.php", controller, modules, setting database, helper ... -> view
- Cách lấy config từ file application.ini