时间: 2020-12-3|tag: 45次围观|0 条评论

<?php

//1.在开始的定界符中,一定要让定界字符串左边挨着<<<,写结束定界符号时一定要直接回车顶格写(连空格都不可以有);

//2.结束的定界符号要和开始的字符串一致;

//3.使用定界字符时,支持解析双引号和转义字符的功能;

$int=10;


$str1=<<<dingjie


       this $int is a demo;


this is a\n test;


this is the\r dingjie.txt;


this is the open ;

dingjie;


echo $str1;

//4.使用定界符号可以有效的阻止因为单双引号嵌套而产生的报错;

//5.要想让定界符号失去双引号的功能,可以使用将开始定界符号加上单引号的方法;


$str2=<<<'hello'


        this 'is' $int the two simple;


i 'love\n php';


i "fall in\r love with" study;


A person who know the meaning of studying,he knows the meaning of the life;

hello;


echo $str2;

?>

原文链接:https://blog.csdn.net/living_ren/article/details/72811060

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《PHP中定界符的使用注意事项
   

还没有人抢沙发呢~