Chương trình học
- Bức tranh tổng thể về Lập trình WEB 1
- Cài đặt môi trường Lập trình PHP 1
-
PHP căn bản
6
- PHP là gì? Viết chương trình PHP đầu tiên
- Các kiểu dữ liệu (data types), biến (variables), hằng số (constant), toán tử (operators) trong ngôn ngữ lập trình PHP
- Bài tập Kiểm tra cú pháp PHP
- Trình diễn (render) dữ liệu Đơn giản ra giao diện (HTML, CSS, JS) sử dụng PHP
- Trình diễn (render) dữ liệu Danh sách Array ra giao diện (HTML, CSS, JS) sử dụng PHP
- Bài tập trình diện (render) tổng hợp: hiển thị mẫu in Hóa đơn bán hàng Nền tảng
- Cấu trúc điều khiển trong PHP
- PHP Nâng cao 7
- Bài tập thực hành 3
- Thực hiện Dự án PHP thực tế mẫu - sử dụng PHP thuần 3
- Thu thập và Xử lý dữ liệu từ Client đến Server trong PHP 3
-
Thao tác với Cơ sở dữ liệu MySQL
9
- Quy trình (workflow) xử lý thao tác với cơ sở dữ liệu MySQL trong PHP
- Tạo kết nối đến CSDL MySQL trong PHP
- Thực thi câu lệnh INSERT trong PHP
- Thực thi câu lệnh UPDATE trong PHP
- Thực thi câu lệnh DELETE trong PHP
- Thực thi câu lệnh SELECT trong PHP
- Thực thi câu lệnh INSERT với FORM trong PHP
- Thực thi câu lệnh DELETE với FORM trong PHP
- Thực thi câu lệnh UPDATE với FORM trong PHP
-
Dự án thực tế mẫu (PHP thuần) - Trang web bán hàng trực tuyến - Thiết kế Backend
17
- Khái niệm về bố cục (layouts) trong thiết kế giao diện Web / App
- Thiết kế bố cục (layouts) cho giao diện Backend sử dụng PHP thuần
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục Phẳng - Index
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục Phẳng - Create
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục Phẳng - Delete
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục Phẳng - Edit
- Ràng buộc dữ liệu (validation)
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục cho Liên kết Khóa ngoại
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) upload hình Sản phẩm (upload đơn, mỗi lần 1 file)
- Tạo trang Đăng nhập trong Backend
- Tạo trang Đăng xuất trong Backend
- Tạo Web API lấy dữ liệu báo cáo thống kê
- Tạo trang Bảng tin (Dashboard)
- Tạo chức năng Quản lý Đơn hàng dạng Master Detail (lưu một dòng cha và nhiều dòng con) - Index
- Tạo chức năng Quản lý Đơn hàng dạng Master Detail (lưu một dòng cha và nhiều dòng con) - In ấn Print
- Tạo chức năng Quản lý Đơn hàng dạng Master Detail (lưu một dòng cha và nhiều dòng con) - Xóa Delete
- Tạo chức năng Quản lý Đơn hàng dạng Master Detail (lưu một dòng cha và nhiều dòng con) - Thêm mới Create
- Dự án thực tế mẫu (PHP thuần) - Trang web bán hàng trực tuyến - Thiết kế Frontend 7
- Bảo mật Trang web PHP 2
-
Tài liệu Tham khảo
11
- Tài liệu Tham khảo
- Cách export (dump) cơ sở dữ liệu MySQL bằng HeidiSQL
- Đệ quy đa cấp trong PHP
- Tạo bố cục (layout) trang web sử dụng INCLUDE REQUIRE trong PHP
- Bài tập tổng hợp - Tạo trang web đọc Truyện Tranh và Tiểu Thuyết Online
- Cách triển khai Web lên Hosting free ByetHost
- Nguyên nhân và cách xử lý lỗi Warning: Cannot modify header information - headers already sent by
- Cách triển khai Web lên Hosting free 000WebHost
- Cách tích hợp chứng thực tài khoản bằng Google vào trang web
- Source code Tham khảo Learning.NenTang.vn
- Database mẫu ví dụ Bán hàng Salomon
- Nộp đồ án 1
-
Thao tác với cơ sở dữ liệu MySQL bằng kỹ thuật AJAX
8
- Tạo API cho chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Index
- Tạo API cho chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Create
- Tạo API cho chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Edit
- Tạo API cho chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Delete
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Index
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Create
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Edit
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Delete
- Video Live Stream 1
- Lập trình hướng đối tượng OOP (Object Oriented Programming) trong PHP 1
Why use Comments?
- If you don’t work on the source code for some time, it’s easy to forget what the code does. Commenting the source code helps remember what the code does.
- Commenting source code is also very important when multiple developers have to work on the same project. The changes made by one developer can be easily understood by other developers by simply reading the comments.
- As the best practice, you must have 3 lines of comments for every 10 lines of code
PHP Comments
- Comments help us to understand the code
- Comments are explanations that we include in our source code. These comments are for human understanding.
- Single line comments start with double forward slashes // and they end in the same line.
- Multiple line comments start with a forward slash followed by the asterisk /* and end with the asterisk followed by the forward slash */.
PHP Include & PHP Include_once
The “include” php statement is used to include other files into a PHP file. It has two variations, include and include_once. Include_once is ignored by the PHP interpreter if the file to be included. The include statement has the following syntax<?php include 'file_name'; ?>The include_once statement has the following syntax
<?php include_once 'file_name'; ?>HERE,
- “Include/include_once” is the statement that includes file
- “'file_name'” is the name of the file to be included.
Example : Include / Include_once
Suppose you are developing a website that contains the same navigation menu across all the pages. You can create a common header then include it in every page using the include statement Let’s see how this can be done.- We will create 2 files names
- header.php, index.php
<a href="/index.php">Home</a> <a href="/aboutus.php">About us</a> <a href="/services.php">Services</a> <a href="/contactus.php">Contact Us</a>index.php
<?php include 'header.php'; ?>The header page above will output
PHP Require & PHP require_once
The require statement has two variations, require and require_once. The require/require_once statement is used to include file. Require_once is ignored if the required file has already been added by any of the four include statements. It has the following syntax<?php require 'file_name'; ?>
<?php require_once 'file_name'; ?>HERE,
- “require/require_once” is the statement that includes file
- “'file_name'” is the name of the file to be included.
Example : Require
Suppose we are developing a database powered application. We can create a configuration file that we can include in all pages that connect to the database using the require statement. config.php<?php $config['host'] = 'localhost'; $config['db'] = 'my_database'; $config['uid'] = 'root'; $config['password'] = ''; ?>Let’s now look at the sample code that requires the config file. Pages_model.php
<?php require 'config.php'; //require the config file //other code for connecting to the database ?>
Php include vs require
The difference between include / requireInclude | Require |
---|---|
Issues a warning when an error occurs | Does not issue a warning |
Execution of the script continues when an error occurs | Execution of the script stops when an error occurs. |
Summary
- Single HTML code such as headers, footers, side bars etc. can be shared across many pages. This makes it easy to update the website by just updating a single file.
- PHP code such as database configuration settings, custom functions etc. can be shared across many pages ensuring the website/application uses the same settings.
- Comments are used to help understand source code. They are for human understanding
- Single line comment statements start with double forward slashes //.
- Multi-line comment statements are enclosed between /* statements */.
- The “include, include_once, require and require_once” statements are used to include files.
- Include_once/require_once is ignored if the requested file has already been included using any of the four statements.
- The “include” statement issues a warning and continues with the execution if the requested file has not been found.
- The require statement raises a fatal error and stops the script execution.
- The “include” statement should be in most cases except in situations where without the requested file to be include, the entire script cannot run.
Mục lục
Các bài học
Bài học tiếp theo
Chương trình học
Bao gồm Module, Chương, Bài học, Bài tập, Kiểm tra...Chương trình học
- Bức tranh tổng thể về Lập trình WEB 1
- Cài đặt môi trường Lập trình PHP 1
-
PHP căn bản
6
- PHP là gì? Viết chương trình PHP đầu tiên
- Các kiểu dữ liệu (data types), biến (variables), hằng số (constant), toán tử (operators) trong ngôn ngữ lập trình PHP
- Bài tập Kiểm tra cú pháp PHP
- Trình diễn (render) dữ liệu Đơn giản ra giao diện (HTML, CSS, JS) sử dụng PHP
- Trình diễn (render) dữ liệu Danh sách Array ra giao diện (HTML, CSS, JS) sử dụng PHP
- Bài tập trình diện (render) tổng hợp: hiển thị mẫu in Hóa đơn bán hàng Nền tảng
- Cấu trúc điều khiển trong PHP
- PHP Nâng cao 7
- Bài tập thực hành 3
- Thực hiện Dự án PHP thực tế mẫu - sử dụng PHP thuần 3
- Thu thập và Xử lý dữ liệu từ Client đến Server trong PHP 3
-
Thao tác với Cơ sở dữ liệu MySQL
9
- Quy trình (workflow) xử lý thao tác với cơ sở dữ liệu MySQL trong PHP
- Tạo kết nối đến CSDL MySQL trong PHP
- Thực thi câu lệnh INSERT trong PHP
- Thực thi câu lệnh UPDATE trong PHP
- Thực thi câu lệnh DELETE trong PHP
- Thực thi câu lệnh SELECT trong PHP
- Thực thi câu lệnh INSERT với FORM trong PHP
- Thực thi câu lệnh DELETE với FORM trong PHP
- Thực thi câu lệnh UPDATE với FORM trong PHP
-
Dự án thực tế mẫu (PHP thuần) - Trang web bán hàng trực tuyến - Thiết kế Backend
17
- Khái niệm về bố cục (layouts) trong thiết kế giao diện Web / App
- Thiết kế bố cục (layouts) cho giao diện Backend sử dụng PHP thuần
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục Phẳng - Index
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục Phẳng - Create
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục Phẳng - Delete
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục Phẳng - Edit
- Ràng buộc dữ liệu (validation)
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) cho danh mục cho Liên kết Khóa ngoại
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) upload hình Sản phẩm (upload đơn, mỗi lần 1 file)
- Tạo trang Đăng nhập trong Backend
- Tạo trang Đăng xuất trong Backend
- Tạo Web API lấy dữ liệu báo cáo thống kê
- Tạo trang Bảng tin (Dashboard)
- Tạo chức năng Quản lý Đơn hàng dạng Master Detail (lưu một dòng cha và nhiều dòng con) - Index
- Tạo chức năng Quản lý Đơn hàng dạng Master Detail (lưu một dòng cha và nhiều dòng con) - In ấn Print
- Tạo chức năng Quản lý Đơn hàng dạng Master Detail (lưu một dòng cha và nhiều dòng con) - Xóa Delete
- Tạo chức năng Quản lý Đơn hàng dạng Master Detail (lưu một dòng cha và nhiều dòng con) - Thêm mới Create
- Dự án thực tế mẫu (PHP thuần) - Trang web bán hàng trực tuyến - Thiết kế Frontend 7
- Bảo mật Trang web PHP 2
-
Tài liệu Tham khảo
11
- Tài liệu Tham khảo
- Cách export (dump) cơ sở dữ liệu MySQL bằng HeidiSQL
- Đệ quy đa cấp trong PHP
- Tạo bố cục (layout) trang web sử dụng INCLUDE REQUIRE trong PHP
- Bài tập tổng hợp - Tạo trang web đọc Truyện Tranh và Tiểu Thuyết Online
- Cách triển khai Web lên Hosting free ByetHost
- Nguyên nhân và cách xử lý lỗi Warning: Cannot modify header information - headers already sent by
- Cách triển khai Web lên Hosting free 000WebHost
- Cách tích hợp chứng thực tài khoản bằng Google vào trang web
- Source code Tham khảo Learning.NenTang.vn
- Database mẫu ví dụ Bán hàng Salomon
- Nộp đồ án 1
-
Thao tác với cơ sở dữ liệu MySQL bằng kỹ thuật AJAX
8
- Tạo API cho chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Index
- Tạo API cho chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Create
- Tạo API cho chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Edit
- Tạo API cho chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Delete
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Index
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Create
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Edit
- Tạo chức năng CRUD (Xem-Read, Thêm-Create, Sửa-Edit, Xóa-Delete) bằng kỹ thuật AJAX cho danh mục Phẳng - Delete
- Video Live Stream 1
- Lập trình hướng đối tượng OOP (Object Oriented Programming) trong PHP 1
Bài học tiếp theo
Menu Tiện ích
Menu Hướng dẫn Học tập
❤🧡💛💚💙💜 Học là phải THỰC HÀNH ❤🧡💛💚💙💜
Thực hiện các bước tuần tự theo nội dung Bài học nhé!