TAILIEUCHUNG - Beginning PHP6, Apache, MySQL Web Development- P24

Beginning PHP6, Apache, MySQL Web Development- P24:Welcome to Beginning PHP6, Apache, MySQL Web Development , your new trusty resource for assistance in creating your own dynamic web sites. There are a lot of technologies available that can be used to deliver great web sites, and we ’ re glad you chose the Apache/MySQL/PHP (sometimes referred to simply as AMP) approach. You may or may not have had a taste of these three components in the past, but either way we ’ re confident that you will be impressed with the power that lies within them | Appendix B PHP Quick Reference Functions You can create and call functions using the following syntax function funcname defines the function line of php code line of php code funcname calls the function to execute Values can be passed in and returned from functions function add value1 value2 add two numbers together value3 value1 value2 return value3 val funcname 1 1 val 2 Classes You can define new objects and use its methods using the following syntax class ClassName class definition public var1 property with public access private var2 property with private access constructor method public function __constructs code to initialize object goes here public method public function setFoo value properties and methods are accessed inside the class using this- this- var2 value private method private function bar more code goes here destructor method public function __destruct clean up code goes here 691 Appendix B PHP Quick Reference c new ClassName create a new instance of the object c- var1 42 properties and methods are accessed using - c- setFoo Hello World Namespaces Namespaces are one of the more recent additions to PHP s syntax added in version and help prevent name clashing. Namespaces can contain class constant and function definitions. Namespaces are declared with the namespace keyword at the beginning of a file namespace MyProject Foo Bar function fizz . When using functions and classes that are defined within a namespace they can be referenced by their full name var MyProject Foo Bar fizz Namespaces can be imported with the use keyword use MyProject Foo Bar var fizz Namespaces can be aliased with use as use MyProject Foo Bar as my var my fizz Using MySQL This is the basic sequence for connecting to a MySQL database executing a SELECT query and displaying the results connect to MySQL db mysql_connect localhost username password or die Unable to connect. Check your connection parameters. select the correct database mysql_select_db database db or die .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
34    2    0    12-08-2020
9    2    0    12-08-2020
20    8    0    12-08-2020
7    5    0    12-08-2020
TÀI LIỆU LIÊN QUAN
19    16    0
182    15    0
138    6    0
3    7    0
142    12    0