Home > Backend Development > 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

WBOY
Release: 2016-07-13 10:19:25
Original
806 people have browsed it

PHP基本语法的小结,PHP基本语法小结of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial>

一、PHP能做什么?

PHP能做什么?我觉得它很强大,只要我能想到的,它都能做,只是我技术能力还不行╮(╯﹏╰)╭。好吧,一张图,基本了解一下吧(ps:PHP的功能不局限于此( ^_^ ))

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.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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<span id="lnum6">   6:<span>     </head></span></span>
Copy after login
<span id="lnum7">   7:<span>         <!-- 在属性位置嵌入 --></span></span>
Copy after login
<span id="lnum8">   8:<span>     <body <?php <span>echo <span>'bgcolor="#ccc"'?>></span></span></span></span>
Copy after login
<span id="lnum9">   9:<span>         <!-- 来个高级点的吧 --></span></span>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
Copy after login
<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>
Copy after login
<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>
Copy after login

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>
Copy after login
Copy after login
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login

三、变量

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>
Copy after login
Copy after login
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<span id="lnum6">   6:<span>     $i站点is = <span>"php"; <span>//合法变量名,可以使用中文</span></span></span></span>
Copy after login
<span id="lnum7">   7:<span>     <span>/*</span></span></span>
Copy after login
<span id="lnum8">   8:<span> <span>    *以下三个函数调用方式等效</span></span></span>
Copy after login
<span id="lnum9">   9:<span> <span>    *关键字和内置函数及用户自定义的类名,函数名不区分大小写</span></span></span>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
Copy after login
Copy after login
<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>
Copy after login
Copy after login
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
Copy after login
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login

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>
Copy after login
Copy after login
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<span id="lnum8">   8:</span>
Copy after login
<span id="lnum9">   9:<span>     <span>//使用define函数检验FLO常量是否存在,存在则输出常量值</span></span></span>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login
<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>
Copy after login

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

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


来源: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

php基本语法问题of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial>

双引号是用于输出字符串的。例如: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与数据库的基本语法已经基本掌握推荐一本有完整项目的php的书??本人真的很想学好phpof basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial>

"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? ?

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/87Summary 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 tutorial8.htmlTechArticleSummary of PHP basic syntax, summary of PHP basic syntax Summary of basic syntax of PHP, summary of basic syntax of PHP_PHP tutorial. What can PHP do? What can PHP do? I think it is very powerful. It can do anything I can think of, but my technical skills are not yet...
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template