Danh mục

PHP and MySQL by Example- P2

Số trang: 50      Loại file: pdf      Dung lượng: 1.38 MB      Lượt xem: 9      Lượt tải: 0    
tailieu_vip

Hỗ trợ phí lưu trữ khi tải xuống: 18,000 VND Tải xuống file đầy đủ (50 trang) 0
Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu php and mysql by example- p2, công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
PHP and MySQL by Example- P2 Table 3.1. PHP Syntax and Constructs The tags The PHP script is placed between the PHP open tag . The code between these two tags is what the PHP module processes. The HTML code is just left as is (see Chapter 2, “Getting Started”). Instantiating a class: $cat = new Pet; // Create object with a constructor method $cat->set_name(Sneaky); // Access object with an instance method echo Your cat is rightly named ,$cat->get_name(), . Table 3.1. PHP Syntax and Constructs The tags The PHP script is placed between the PHP open tag . The code between these two tags is what the PHP module processes. The HTML code is just left as is (see Chapter 2, “Getting Started”). $this->password = urAok5; // private } function setUserId($userId){ $this->userId=$userId; } function getUserId() { return $this->userId; } private function setPassword($password){ // private method $this->password=$password; } private function getPassword(){ return $this->password; } } class Laptop extends Computer{ // Child/derived/subclass public $brand; public $weight; private $password=LetMeIn2; function __construct($brand,$weight){ // Subclass constructor parent::__construct(); // Call to parents constructor echo Child constructor just called. ; $this->brand=$brand; // new properties for the child $this->weight=$weight; } } function __destruct(){ echo $this being destroyed ; } function setPassword($password){ $this->password=$password; } function getPassword(){ return $this->password; } }Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Table 3.1. PHP Syntax and Constructs The tags The PHP script is placed between the PHP open tag . The code between these two tags is what the PHP module processes. The HTML code is just left as is (see Chapter 2, “Getting Started”). // Class user $pc=new Computer(); // Create two new objects $portable = new Laptop(); $portable->setPassword(letmein2); ..... Files PHP comes with a set of built-‐in functions that allow you to work with files. You can include external files with the require and include statements. The included files can consist of PHP, HTML, XML, text, and so on. The requested file’s contents replace the line containing the word require or include. EXAMPLE To include a file: // replaces instances of require with the contents of file require(copyright.inc); // replaces only first instance of requ ...

Tài liệu được xem nhiều: