Blogger Information
Blog 38
fans 0
comment 1
visits 30405
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
4月11日作业PHP对字符串的处理规则
1
Original
456 people have browsed it

实例

<meta charset="utf-8">
<?php 
header("Content-type:text/html;charset=utf-8");

	/**
	 * 1.变量创建
	 *
	 * 2.双引号会解析内容
	 *
	 * 3.单引号原样输出
	 *
	 * 4.\可以转义字符
	 *
	 * 5.nl2br()可以\n进行转义
	 *
	 * 6.$heredoc = <<< "HEREDOC" XXXXXX HEREDOC 同2
	 *
	 * 7.$nowdoc = <<< 'NOWDOC' XXXXXXX NOWDOC  同3	
	 */
	$name = '蚊子';
	echo $title = '$name飞着飞着就不见了';
	echo'<br>';
	echo $text = "{$name}飞着飞着就不见了";
	echo '<hr>';
	echo '蚊子:\'飞着飞着就不见了\'';
	echo'<br>';
	echo '蚊子:\"飞着飞着就不见了\"';
	echo'<br>';
	// 单引号原样输出我没骗你吧
	echo '蚊子:"飞着飞着就不见了"';
	echo '<hr>';
	echo '蚊子:飞着飞着就\n不见了';
	echo'<br>';
	echo $text2 = "蚊子:飞着飞着就\n不见了";
	echo'<br>';
	echo nl2br($text2);
	echo '<hr>';
	$heredoc = <<< HEREDOC
	蚊子飞着飞着就不见了\n好烦啊!
HEREDOC;
	echo $heredoc;	
	echo'<br>';
	echo nl2br($heredoc);
	echo'<br>';
	$nowdoc = <<< 'NOWDOC'

	蚊子飞着飞着就不见了 \n 真烦!
NOWDOC;
	echo $nowdoc;
 ?>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
  • 1
    2018-03-16 00:39:40
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!