1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Php cơ bản

5 357 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 19,84 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Before your begin: Before you begin, its important that you know Windows or Unix. A working knowledge of Windows or Unix makes it much easier to learn HTML. You should be familiar with:  Basic word processing using any text editor.  How to create directories and files.  How to navigate through different directories.  Basic understanding on internet browsing using a browser like Internet Explorer or Firefox etc.  Basic understanding on developing simple Web Pages using HTML or XHTML. If you are new to HTML and XHTML then I would suggest you to go through our HTML Tutorial or XHTML Tutorial. Anyone of HTML or XHTML is enough to proceed. What is CSS?

Trang 1

Section 1 PHP Basic

1 Intro

a What you should already know?

Before you continue you should have a basic understanding of the following:

+HTML

+Css

+Javascript

b What is Php?

Php is an acronym for “PHP Hypertext Preprocessor”

Php is a widely-used,open source scripting language

Php scripts are executed on the server

Php costs nothing,it is free to download and use

c What is a Php file?

Php file can contain text,html,css,javascript and php code

Php code are executed on the sever,and the result is returned to the browser as plain html Php files have extension “.php”

d What can Php do?

PHP can generate dynamic page content

PHP can create, open, read, write, and close files on the server

PHP can collect form data

PHP can send and receive cookies

PHP can add, delete, modify data in your database

PHP can restrict users to access some pages on your website

PHP can encrypt data

*With PHP you are not limited to output HTML You can output images, PDF files, and even Flash movies You can also output any text, such as XHTML and XML

e Why Php?

PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)

PHP is compatible with almost all servers used today (Apache, IIS, etc

PHP supports a wide range of databases

PHP is free Download it from the official PHP resource: www.php.net

PHP is easy to learn and runs efficiently on the server side

2 Install

You can setup Xamp Server…

3 Syntax

a Basic Php syntax

A php script be placed anywhere in the document

A php script starts with <?php and ends with ?>

The default file extension for PHP files is ".php"

A PHP file normally contains HTML tags, and some PHP scripting code

Note: PHP statements are terminated by semicolon (;) The closing tag of a block of PHP code also automatically implies a semicolon (so you do not have to have a semicolon terminating the last line of a PHP block)

b Comments in php

A comment in PHP code is a line that is not read/executed as part of the program Its only purpose is to be read by someone who is editing the code!

c Php case sensitivity

Trang 2

4 Variables

5 Echo/Print

6 Data types

7 String functions

1 Strlen($str)

Trả về độ dài của chuỗi $str

Example:

strlen(‘Lê Hoàng Anh’) trả về giá trị là 23

strlen(‘Snow’) trả về giá trị 4

2 Strpos($str,$str1,$int)

Trả về vị trí xuất hiện đầu tiên của $str1 trong $str (nếu $str1 là chuỗi con của $str)

Nếu $int=0 hoặc không khai báo thì tìm từ đầu chuỗi.Nếu $int!=0 thì tìm từ vị trí thứ thứ 2 trở đi Example:

Strpos(‘My name is Snow’,’name’) trả về giá trị là 3

Strpos(‘My name is Snow’,’name’,0) trả về giá trị là 3

Strpos(‘abababndkasndkas’,’ab’,1) trả về giá trị là 2

3 Wordwrap($str,$int,$str1,$bool)

4

8 Constants

9 Operators

a Arithmetic Operator

Operator Name Example Result

b Assignment Operator

Assignment

X+=y

x-=y

X*=y

x/=y

X=y

X%=y

c String Operator

là nối chuỗi.Ví dụ $txt1=”Lê Hoàng ” $txt2=$txt1.”Anh” thì $txt2=”Lê Hoàng Anh”

.= tương tự như +=…

d Increment/Decrement Operator

++$x Tăng giá trị $x lên 1 và gán $x cho biến

$x++ Gán $x cho biến sau đó tăng giá trị của $x lên 1

Tương tự ta có 2 phép nữa là $x và $x

e Comparison Operator

f Logic operator

g Array Operator

Trang 3

10 If…else…elseif

11 Switch

12 While loop

13 For loop

14 Function

15 Array

16 Sorting array

17 Superglobal

Section 2 Php Forms

1 Handling

$_POST và $_GET đều lấy thông tin trên form để dung vào trang nào đó

$_POST không cho hiển thị thông tin trên url

$_GET cho hiển thị thông tin trên url

Trang 4

2 Validation

3 Required

4 URL/E-mail

5 Complete

Section 3 Php Advanced

1 Arrays Multi

2 Date

3 Include

4 File

5 File Upload

6 Cookies

7 Sessions

8 E-mail

9 Secure E-mail

10 Error

11 Exception

12 Filter

Section 4 Php Database

1 MYSQL Intro

2 MYSQL Connect

3 Create db/table

4 Insert into

5 Select

6 Where

7 Order by

8 Update

9 Delete

Section 5 Php Xml

1 Expat Parser

2 Dom

3 SimpleXML

Section 6 Php Ajax

1 Intro

2 Php

Trang 5

3 Database

4 XML

5 Live search

6 RSS Reader

7 Poll

Section 7 Php Reference

1 Array

2 Calendar

3 Date

4 Directory

5 Error

6 Filesystem

7 Filter

8 FTP

9 HTTP

10 Libxml

11 Mail

13 Misc

14 MySQLi

15 SimpleXML

16 String

19 Timezones

Section 8 Php Quiz

1 Quiz

2 Certificate

Ngày đăng: 19/11/2014, 20:49

TỪ KHÓA LIÊN QUAN

w