Heim  >  Artikel  >  Backend-Entwicklung  >  PHP小知识

PHP小知识

WBOY
WBOYOriginal
2016-08-08 09:21:37807Durchsuche

include和require的小区别
include是包含,如果指定的文件无法定位,代码继续运行,
require是必须,但用require时如果未找到指定的文件,代码会停止运行并抛下一个致命的错误。
在这两种情况,文件未找到时都会报错,但只有require语句会完全终止代码的运行。
echo和print
print输出完成时返回1,只支持一个参数,而echo是支持多个参数。
echo也可以用 PHP短标记和等号=组合,只要short_open_tag设置为on,但默认是off,
="sending out some text";?>
单引号和双引号引起字符串
因为单引号中的变量不会被解析,例如
echo '$abc';
echo "$abc";
否则使用字符串连接操作符 .
echo 'The first name of the '.$abc.'and his last name is'.$lname;
var_dump函数来打印输出,因为它比使用echo或者print能得到更多的输出信息。

版权声明:本文为博主原创文章,未经博主允许不得转载。

以上就介绍了PHP小知识,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn