PHP points to note:
在有html语句的文件里,不管是html文件还是php文件,可以在任何地方添加php语句,但必须有开始和结束标记,即'
' 纯php文件时,可不用添加php结束符,如:'?>' 变量可以不声明,直接使用; 单引号与双引号:单引号不解析变量,双引号会解析变量 单引号与双引号:单引号只解析'\','\\'这两个转义符,双引号不解析转义符,会原样输出。 在html中,'\n','\r','\tab'在页面里都会转成一个空格。 可用花括号来区别变量与其它字符,形式如:'${变量名称}'、'{$变量名称}',且花括号与变量间不要有空格,不然会输出花括号
Garbled problem:
The page is a Chinese garbled reason, the file with what code to save, it needs to be opened with the corresponding code, if the use of encoding and save the encoding does not correspond, there will be garbled.
When the page is garbled, you can add the corresponding way code in the head of the page:
如head是标签里添加: <meta http-equiv="Content-Type" content="text/html;" charset="gb2312"/> 如果是php文件,则可以开头输入以下语句 header('content-type:text/html;charset=utf-8');
In PHP, you can use Heredoc and Nowdoc in addition to single quotes "and double quotes" as strings.
Heredoc starts with three less than sign, which is the equivalent of double quotes, which can parse the variable that appears, in the following format
<< name HTML content Name:
!--? php
$tempTable =
<< This is a heredoc example Heredoc HTML that is suitable for entering longer text in a PHP file ?
Nowdoc similar to Heredocs format, but the name is double-quoted, php5.3 above can be used, equivalent to the function of single quotation marks, that is, the output content, as follows:
Copyright notice: This article is the original article, reproduced need to indicate the source, the article views only represent the view at that time, there must be insufficient, welcome to make bricks remind, thank you very much!
Above describes the PHP learning note _3_php syntax to note the points and Heredoc and Nowdoc, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.
table;
<<< " name " HTML content name; Example: !--? php $tempTable = <<< ' TABLE '!--input HTML content--> This is nowdoc example Nowdoc equivalent double quotes
table; ?