小白教程
所有教程
关于
Search
172.69.7.198
172.69.7.198
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func string print”的源代码
本页内容
上一节:
Func_string_parse_str
下一节:
Func_string_printf
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:print()}}[[分类:PHP字符串函数参考手册|39]] = PHP print() 函数 = [[:分类:PHP字符串函数参考手册]] 输出一些文本: <sample title="" desc="" lang="php" hererun="1"> <?php print "Hello world!"; ?> </sample> == 定义和用法 == print() 函数输出一个或多个字符串。 '''注释:'''print() 函数实际不是一个函数,所以您不必对它使用括号。 '''提示:'''print() 函数比 [[func string echo|echo()]] 速度稍慢。 == 语法 == <pre> print(strings) </pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | strings | 必需。发送到输出的一个或多个字符串。 |} == 技术细节 == {| class="table table-striped table-hover" | 返回值: | 总是返回 1。 |- | PHP 版本: | 4+ |} == 更多实例 == == 实例 1 == 输出字符串变量($str)的值: <sample title="" desc="" lang="php" hererun="1"> <?php $str = "Hello world!"; print $str; ?> </sample> == 实例 2 == 输出字符串变量($str)的值,包含 HTML 标签: <sample title="" desc="" lang="php" hererun="1"> <?php $str = "Hello world!"; print $str; print "<br>What a nice day!"; ?> </sample> == 实例 3 == 连接两个字符串变量: <sample title="" desc="" lang="php" hererun="1"> <?php $str1="Hello world!"; $str2="What a nice day!"; print $str1 . " " . $str2; ?> </sample> == 实例 4 == 输出数组的值: <sample title="" desc="" lang="php" hererun="1"> <?php $age=array("Peter"=>"35"); print "Peter is " . $age['Peter'] . " years old."; ?> </sample> == 实例 5 == 输出一些文本: <sample title="" desc="" lang="php" hererun="1"> <?php print "This text spans multiple lines."; ?> </sample> == 实例 6 == 单引号和双引号的区别。单引号将输出变量名称,而不是值:: <sample title="" desc="" lang="php" hererun="1"> <?php $color = "red"; print "Roses are $color"; print "<br>"; print 'Roses are $color'; ?> </sample> [[:分类:PHP字符串函数参考手册]]
返回至“
Func string print
”。
上一节:
Func_string_parse_str
下一节:
Func_string_printf