


Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial
一、PHP能做什么?
PHP能做什么?我觉得它很强大,只要我能想到的,它都能做,只是我技术能力还不行╮(╯﹏╰)╭。好吧,一张图,基本了解一下吧(ps:PHP的功能不局限于此( ^_^ ))
图像有点模糊,凑合一下,(≧▽≦)/
二、PHP语言标记
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial、结束和开始标记
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial :属于xml风格,是PHP的标准风格,推荐使用。
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial :长风格标记,不常用。若你的奇葩编辑器不支持其他php标记,就用它吧
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial //code ?>:简短风格,遵循SGML处理。需要在php.ini中将指令short_open_tag打开,或者在php编译时加入–enable- short-tags.如果你想你的程序移植性好,就抛弃这种风格,它就比Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial少了个php。
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial、位置
怎么说呢?反正可以将PHP语言放在后缀名为.php的HTML文件的任何地方。注意了,是以.php结尾的HTML文件。
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <html></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <head></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <meta http-equiv=<span>"content-type" content=<span>"text/html;charset=utf-8"></span></span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <!-- 在HTML标记中嵌入脚本 --></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <title><?php <span>echo <span>"PHP语言标记" ?></title></span></span></span></span>
<span id="lnum6"> 6:<span> </head></span></span>
<span id="lnum7"> 7:<span> <!-- 在属性位置嵌入 --></span></span>
<span id="lnum8"> 8:<span> <body <?php <span>echo <span>'bgcolor="#ccc"'?>></span></span></span></span>
<span id="lnum9"> 9:<span> <!-- 来个高级点的吧 --></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0:<span> <?php</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span>if($exp){</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> ?></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <!-- 属性值中嵌入php --></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <p align=<span>"<?php echo 'center'?>">条件为true该做的</p></span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <?php</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial6"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial6:<span> }<span>else{</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial7"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial7:<span> ?></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial8"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial8:<span> <p>条件为FALSE该做的</p></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9:<span> <?php</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0:<span> }</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> ?></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> </body></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> </html></span></span>
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial、注释
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial 单行注释:// 或者 # 多行注释:/* 说明*/
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial 多行注释不能嵌套,但是其中可以包含单行注释;单行注释也可以包含多行注释。就想这样子
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <?php</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span>//echo "test";/*单行中包含多行注释符*/</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span>/*echo 'test'; //多行注释符中包含单行注释符*/</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> ?></span></span>
三、变量
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial、变量的使用
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <?php</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> $a = Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial; <span>//声明一个变量a</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> $b = <span>"php"; <span>//声明一个变量b</span></span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> $8d = Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial; <span>//非法变量名,只能以字母或者下划线开头且不包含空格</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:</span>
<span id="lnum6"> 6:<span> $i站点is = <span>"php"; <span>//合法变量名,可以使用中文</span></span></span></span>
<span id="lnum7"> 7:<span> <span>/*</span></span></span>
<span id="lnum8"> 8:<span> <span> *以下三个函数调用方式等效</span></span></span>
<span id="lnum9"> 9:<span> <span> *关键字和内置函数及用户自定义的类名,函数名不区分大小写</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0:<span> <span> */</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> phpinfo();</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> phpinfo();</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> phpinfo();</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:</span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:</span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial6"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial6:<span> <span>/*</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial7"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial7:<span> <span> *以下三个变量不一样</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial8"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial8:<span> <span> *变量名是区分大小写滴</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9:<span> <span> */</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0:<span> $name = <span>"phpSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial";</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> $Name = <span>"phpSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial";</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> $Name = <span>"phpSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial";</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:</span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span>//可变变量:变量名可以动态的设置</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> $hi = <span>"hello";</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial6"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial6:<span> $$hi = <span>"world";</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial7"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial7:<span> <span>//以下均输出hello world</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial8"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial8:<span> <span>echo <span>"$hi $hello";</span></span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9:<span> <span>echo <span>"$hi ${$hi}";</span></span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0:</span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span>//变量赋值</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> $foo = <span>"B" <span>//传值赋值</span></span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> $bar = &$foo <span>//引用赋值</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> $bar = <span>"LZ";</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span>echo <span>"$foo"; <span>//输出LZ</span></span></span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial6"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial6:<span> $cde = $foo; <span>//传值赋值</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial7"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial7:<span> $cde = <span>"E";</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial8"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial8:<span> <span>echo <span>"$foo"; <span>//输出LZ</span></span></span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9:<span> ?></span></span>
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial、变量的类型
四、常量
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial、定义和使用
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <?php</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span>/*</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span> *boolean define(string name,mixed value[,bool case_insensitive)</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span> *name:常量名;value:常量值;第三个是个可选的布尔值,默认是FALSE(不区分大小写)</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span> */</span></span></span>
<span id="lnum6"> 6:<span> define(<span>"FLO",Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial000);</span></span></span>
<span id="lnum7"> 7:<span> <span>echo FLO; <span>//输出Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial000</span></span></span></span>
<span id="lnum8"> 8:</span>
<span id="lnum9"> 9:<span> <span>//使用define函数检验FLO常量是否存在,存在则输出常量值</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0:<span> <span>if(define(<span>"FLO"))</span></span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> {</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> <span>echo FLO;</span></span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> }</span></span>
<span id="lnumSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial"> Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial:<span> ?></span></span>
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial、常量和变量
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial 常量的作用域是全局的,可以再脚本的任何地方声明和访问常量。
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial 常量前面没有$,且不能通过赋值语句定义常量。
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial 常量一旦被定义,不能被重新定义或取消定义,直到脚本运行结束自动释放。
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial 常量的值只能是标量(boolean,integer,float,string中的一种类型)
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial、系统的预定义常量
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial、常用的魔术常量
来源:http://www.idoSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial.com/Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorialSummary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial0.html
双引号是用于输出字符串的。例如:echo "数据插入失败,错误信息:
";
而"INSERT INTO testtable VALUES(Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9;".$xm."Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial9;,".$nl.")"; 中INSERT INTO testtable VALUES是字符串,意思是向数据库中插入,两个""是一组,将.$xm.分开,(.$xm.)中$xm是一个变量,php中显示一个变量时用echo。
"PHP and MySQL Web Development" is the "php bible". In comparison, "Learning PHP from Zero Basics" is more suitable for beginners. Reading this book, it is easy to feel that the author wrote it carefully.
This book is actually one of the series "Learning Programming from Zero Basics", the others are very good.
The content is well designed. There is a preface that is very pertinent. It is advice given by experienced programmers to newbies. Here is the excerpt:
++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++
Things to note when learning programming A few points:
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial. Don’t memorize grammar: Many beginners try to memorize various grammars. In fact, this is extremely wrong. There are so many grammars and specifications in program development that it is impossible to remember them all. You only need to know that there are Such a function is enough. You can browse books or find help files when needed, which saves time and effort.
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial. Use multiple hands and practice more: People who only know how to chew books will not become masters of development. Only by writing programs on the computer more can you improve your understanding of programming in practice.
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial. When you encounter a problem, try to solve it yourself first: use your own time to try your best to solve it. If it doesn’t work, go to someone for help. Never ask someone for help immediately when you encounter a problem. This will never improve much. .
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial. Use Google and Baidu more: The Internet is a large knowledge base and the best teacher. The problems you encounter have been encountered by others, so search more.
Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial. Read more other people’s source codes: Understand other people’s design ideas and constantly integrate them into your own use.
++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++
The shortcoming of this book is that there are no line markings in front of the code, and "at line xxx," is used extensively in the explanation of the code, A big mistake.
Summary: In terms of knowledge points, "Learning PHP from Zero Basics" may not be complete, but what we need is not a dictionary, what we need is a step-by-step book that will make you interested in learning, right? ?

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP makes it easy to create interactive web content. 1) Dynamically generate content by embedding HTML and display it in real time based on user input or database data. 2) Process form submission and generate dynamic output to ensure that htmlspecialchars is used to prevent XSS. 3) Use MySQL to create a user registration system, and use password_hash and preprocessing statements to enhance security. Mastering these techniques will improve the efficiency of web development.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft