By GokiSoft.com|
19:55 26/04/2022|
Học PHP
[Video] Cài đặt môi trường - Kiến thức căn bản PHP - Khoá học PHP/MySQL
#readme.txt
Nội dung môn học:
- Kiến thức core căn bản
- Khai báo biến
- Toán tử & biểu thức logic
- Mệnh đề điều kiện (if, else, switch, ...)
- Loop (for, while, do .. while, foreach)
- Function
- Object
- Array trong PHP
- Kiến thức xử lý Form
- Cookie
- Session
- Kết nối CSDL (MySQL)
- Class Object (OOP) - Basic
- MVC
- Laravel (Framework PHP)
======================================================================
Lesson 01:
- Cài đặt môi trường
- Win: C://xampp/htdocs
- Mac: //Application/XAMPP/htdocs
- Hiểu về thread biên dịch của PHP
- Khai báo biến
- Toán tử & biểu thức logic
- Mệnh đề điều kiện (if, else, switch, ...)
- Loop (for, while, do .. while, foreach)
- Function
#vidu.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PHP tutorial</title>
</head>
<body>
<h1>Welcome to learn PHP</h1>
<?php
// Gioi thieu ve lap tring PHP
echo '<h2>Hello World</h2>';
print('<h3>Hello World</h3>');
// Khai bao bien
$x = 12; //$x -> Kieu du lieu la int
$x = 'Xin Chao'; //$x -> Kieu du lieu la string
echo $x;
// Luu y: Khi in chuoi + bien trong PHP
echo '<br/>Gia tri x = ';
echo $x;
echo '<br/>Gia tri x = '.$x;
echo '<br/>Gia tri x = $x';
echo "<br/>Gia tri x = ".$x;
echo "<br/>Gia tri x = $x";
// Khai bao bien hang
const BASE_URL = 'https://gokisoft.com';
echo '<br/>'.BASE_URL;
define('URL', 'gokisoft.com');
echo '<br/>'.URL;
// So sanh === voi ==
$x1 = 5; //int
$x2 = 5.0; //float
if($x1 == $x2) {
echo '<br/>5 == 5.0';
} else {
echo '<br/>5 khac 5.0';
}
if($x1 === $x2) {
echo '<br/>5 === 5.0';
} else {
echo '<br/>5 khac 5.0';
}
$x = 5;
// $x = $x + 1; //x = 6
// $x += 1; //x = 6
// $x++;//x = 6
// ++$x;//x = 6
$y = $x++; //x = 6, y = 5
echo "<br/>x = $x, y = $y";
$z = ++$y - --$x + $x++ + 2;
//z = (y=6)6 - (x=5)5 + 5(x=6) + 2 = 8
echo "<br/>x = $x, y = $y, z = $z"; //x = 7 | 5 | 6, y = 6, z = 9 | 8
function tinhtong($x, $y) {
$s = $x + $y;
echo '<br/>'.$s;
}
tinhtong(10, 12);
function tinhtong2($x, $y) {
return $x + $y;
}
$ss = tinhtong2(2, 12);
echo '<br/>'.$ss;
?>
</body>
</html>
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)