天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

php echo 輸出字符串函數(shù)詳解

復(fù)制代碼 代碼如下:
echo "asd";//字符串
echo "ads$c";//字符串+變量
echo 'ads$c';//字符串 asd$c $c不是變量
echo "sd"."vs";
echo "sd","vs";
echo $a;
echo $a.$b;
echo $a,$b;
echo $a.$b.$c;
echo $a,$b,$c;
echo "kaskd{$c}asd";
echo "kakskd{$arr['lo']}";
echo "kakskd{$obj->a}";
echo "kaskd".$c."kasd";
echo "kaskd".$arr['lo']."kasd";
echo "kaskd".$obj->a."kasd";
echo "kaskd".func($c)."kasd";
echo "kaksk".($a+1)."dkkasd";
echo $c."jaksd";
echo $c,"jaksd";
//php多行輸出方法
echo <<<END
This uses the "here document" syntax to output
END;
//輸出簡(jiǎn)寫
<?php echo $a;?>   <?=$a?>


復(fù)制代碼 代碼如下:
<?php
echo "Hello World";

echo "This spans
multiple lines. The newlines will be
output as well";

echo "This spans/nmultiple lines. The newlines will be/noutput as well.";

echo "Escaping characters is done /"Like this/".";

// You can use variables inside of an echo statement
$foo = "foobar";
$bar = "barbaz";

echo "foo is $foo"; // foo is foobar

// You can also use arrays
$baz = array("value" => "foo");

echo "this is {$baz['value']} !"; // this is foo !

// Using single quotes will print the variable name, not the value
echo 'foo is $foo'; // foo is $foo

// If you are not using any other characters, you can just echo variables
echo $foo; // foobar
echo $foo,$bar; // foobarbarbaz

// Some people prefer passing multiple parameters to echo over concatenation.
echo 'This ', 'string ', 'was ', 'made ', 'with multiple parameters.', chr(10);
echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "/n";

echo <<<END
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon. no extra whitespace!
END;

// Because echo does not behave like a function, the following code is invalid.
($some_var) ? echo 'true' : echo 'false';

// However, the following examples will work:
($some_var) ? print 'true' : print 'false'; // print is also a construct, but
// it behaves like a function, so
// it may be used in this context.
echo $some_var ? 'true': 'false'; // changing the statement around
?>

以下是官方手冊(cè)說明:
Definition and Usage
定義和用法
The echo() function outputs one or more strings.
echo()函數(shù)的作用是:輸出一個(gè)或多個(gè)字符串。
Syntax
語法
echo(strings)
Parameter參數(shù) Description描述
strings Required. One or more strings to be sent to the output
必要參數(shù)。指定一個(gè)或多個(gè)需要被發(fā)送到結(jié)果中的字符串
Tips and Notes
提示和注意點(diǎn)
Note: The echo() function is not actually a function, so you are not required to use parentheses with it. However, if you want to pass more than one parameter to echo(), using parentheses will generate a parse error.
注意:echo()函數(shù)不是一個(gè)真正意義上的函數(shù),所以你沒有必要一定去使用它。如果你想把多于一個(gè)的參數(shù)傳遞給echo()函數(shù),那么使用圓括號(hào)“()”將產(chǎn)生錯(cuò)誤。
Tip: The echo() function is slightly faster than print().
提示:echo()函數(shù)相當(dāng)于print()函數(shù)的簡(jiǎn)化版本。
Tip: The echo() function has the following shortcut syntax. See example 5.
提示:echo()函數(shù)包含下面的簡(jiǎn)便寫法。具體見:案例5。
Example 1
案例1
復(fù)制代碼 代碼如下:
<?php
$str = "Who's Kai Jim?";
echo $str;
echo "<br />";
echo $str."<br />I don't know!";
?>

The output of the code above will be:
上述代碼將輸出下面的結(jié)果:
Who's Kai Jim?Who's Kai Jim?I don't know!

Example 2
案例2
復(fù)制代碼 代碼如下:
<?php
echo "This textspans multiplelines.";
?>

The output of the code above will be:
上述代碼將輸出下面的結(jié)果:
This text spans multiple lines.

Example 3
案例3
復(fù)制代碼 代碼如下:
<?php
echo 'This ','string ','was ','made ','with multiple parameters';
?>

The output of the code above will be:
上述代碼將輸出下面的結(jié)果:
This string was made with multiple parameters

Example 4
案例4
Difference of single and double quotes. Single quotes will print the variable name, not the value:
區(qū)別單引號(hào)(')和雙引號(hào)(”)的不同。單引號(hào)將輸出變量名,而不是變量的值:
復(fù)制代碼 代碼如下:
<?php
$color = "red";
echo "Roses are $color";
echo "<br />";
echo 'Roses are $color';
?>

The output of the code above will be:
上述代碼將輸出下面的結(jié)果:
Roses are redRoses are $color

Example 5
案例5
Shortcut syntax:
簡(jiǎn)寫(捷徑)語法:
復(fù)制代碼 代碼如下:
<html><body>
<?php
$color = "red";
?><p>Roses are <?=$color?></p></body></html>

php技術(shù)php echo 輸出字符串函數(shù)詳解,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 快播电影官方网站 | 国产午夜精品理论片在线 | 亚洲欧美无码2017在线 | 久久久久久久久女黄9999 | 一个人的视频在线观看免费观看 | 久久re视频这里精品09首页 | 影音先锋av电影 | 一区二区三区无码高清视频 | 国产精品www视频免费看 | 伊人AV一区二区三区夜色撩人 | 青青青青青青草 | 亚洲日本欧美天堂在线 | 激情内射亚洲一区二区三区爱妻 | 伊人久久精品AV无码一区 | 亚洲精品m在线观看 | 年轻的搜子8中字在线观看 年轻的朋友4在线看中文字幕 | xnxnxn69日本| 精品高清国产a毛片 | 亚洲AV无码一区二区色情蜜芽 | 无码爽死成人777在线观看网站 | 成 人 色综合| 精品一产品大全 | 女人会操出水图 | 日韩精品无码免费专区 | 全黄h全肉细节全文 | 挤奶门事件完整照片 | 24小时日本在线 | 国产精品亚洲高清一区二区 | 亚洲国产精品免费观看 | 欧美顶级情欲片免费看 | 欧美性xxxxxx爱 | 99久久精品久久久久久清纯 | china年轻小帅脸直播飞机 | proburn中文破解版下载 | 十分钟免费看完整视频 | 60岁老年熟妇在线无码 | 亚洲视频第二页 | 国产精品亚洲在钱视频 | 国产精品悠悠久久人妻精品 | 国产中文视频无码成人精品 | 久久黄色免费网站 |