Trong tutorial này mình sẽ hướng dẫn mọi người xây dựng một website về blog đơn giản. Nó sẽ đầy đủ nhất các thứ cần phải có để làm chủ được Framework Codeigniter PHP.
- Codeigniter là gì?
Hiện nay có khá nhiều Frameworks được xây dựng từ PHP như Zend, Laravel, CakePHP, Codeigniter và mỗi framework có những ưu và nhược điểm khác nhau. Có một câu hỏi đặt ra là tại sao chúng ta cần học PHP Framework? Thông thường nếu ban làm dự án bằng PHP thuần thì đòi hỏi bạn phải có kiến thức về bảo mật PHP và PHP nâng cao thì mới quản lý source tốt được. Nhưng khi bạn sử dụng Framework thì bạn sẽ bớt đi thời gian để xử lý hai vấn đề đó bởi vì các Frameworks đã tạo cho chúng ta cái sường để có thể tạo ra những dự án khác nhau. Frameworks đơn giản và dễ học nhất mà ai cũng biết đó là Codeigniter, đây là một framework được xây dựng từ mô hình MVC có ưu điểm là chạy nhanh, dễ học cho người mới tìm hiểu MVC Framework. Codeigniter Framework còn viết tắt là CI Framework.
- Cách cài đặt?
Step 1: Truy cập trang chủ Codeigniter để download. Step 2: Tham khảo video.
- Các Package cần thiết cho Sublime Text khi code Codeigniter
Step 1:
- Window: Ctrl + Shift + P, sau đó nhập Install Package.
- Mac: Command + Shift + P, sau đó nhập Install Package.
Step 2: Install 2 Package.
- Codeigniter Snippets
- Codeigniter Unities
- Các bước khởi tạo dự án:
- Tạo Folder chứa dự án:
- Window: Tạo thư mục tên dự án trong C:\Xampp\htdocs$tenduan
- Mac: Tạo thưc mục tên dự án trong Applications\Mamp\htdocs$tenduan
- Khởi tạo server:
- Thường thì các phần mềm sẽ chuyển sang chorme với địa chỉ: localhost:3333/dashboards < Chú ý: 3333 là port do bạn thiết lập>
- Còn không bạn có thể lên chorme và truy cập địa chỉ bên trên như bình thường.
- Chạy dự án: Bạn truy cập localhost:3333/$tenduan < $tenduan chính là tên thư mục của bạn >