Home  >  Article  >  php教程  >  PHP Echo字符串的连接格式

PHP Echo字符串的连接格式

WBOY
WBOYOriginal
2016-06-06 19:34:191718browse

先给大家说下PHP echo() 函数 定义和用法 echo() 函数输出一个或多个字符串。 注释:echo() 函数实际不是一个函数,所以您不必对它使用括号。然而,如果您希望向 echo() 传递一个以上的参数,使用括号将会生成解析错误。 提示 :echo() 函数比 print() 速度

先给大家说下PHP echo() 函数

定义和用法

echo() 函数输出一个或多个字符串。

注释:echo() 函数实际不是一个函数,所以您不必对它使用括号。然而,如果您希望向 echo() 传递一个以上的参数,使用括号将会生成解析错误。

提示:echo() 函数比 print() 速度稍快。

提示:echo() 函数也有简写语法。在 PHP 5.4.0 之前,该语法只适用于 short_open_tag 配置设置启用的情况。

语法

echo(strings)

参数 描述
strings 必需。一个或多个要发送到输出的字符串。

技术细节

返回值: 无返回值。
PHP 版本:

4+


PHP Echo字符串的连接格式所述如下:

echo "<td align=\"center\"><img  src=\""; </pre alt="PHP Echo字符串的连接格式" >
</p>
<p><br>
1. \" \"<br>
</p>
<p>2. <br>
</p>
<p class="jb51code">
<pre class="brush:php;toolbar:false">
echo <<<theEnd
line 1
line 2
line e
theEnd 

实例

随机三张图片(banner)

<&#63;php
$pictures = array('tire.jpg', 'oil.jpg', 'spark_plug.jpg',
'door.jpg', 'steering_wheel.jpg',
'thermostat.jpg', 'wiper_blade.jpg',
'gasket.jpg', 'brake_pad.jpg');
shuffle($pictures);
&#63;>
<html>
<head>
<title>Bob's Auto Parts</title>
</head>
<body>
<h>Bob's Auto Parts</h>
<div align="center">
<table width = %>
<tr>
<&#63;php
for ($i = ; $i < ; $i++) {
echo "<td align=\"center\"><img src=\"";
echo $pictures[$i];
echo "\"/></td>";
}
&#63;>
</tr>
</table>
</div>
</body>
</html>

以上内容主要给大家介绍PHP Echo字符串的连接格式 ,希望对大家有所帮助!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn