天天躁日日躁狠狠躁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)系我們修改或刪除,多謝。

主站蜘蛛池模板: 在线观看日韩一区 | 天天躁日日躁狠狠躁AV麻豆 | 日本国产成人精品无码区在线网站 | 国产毛多水多高潮高清 | 亚洲乱码高清午夜理论电影 | 亚洲人成在线播放无码 | 国家产午夜精品无人区 | 羞羞一区二区三区四区片 | 妺妺窝人体色777777野大粗 | 一品道门免费高清视频 | 高h肉肉乳共妻 | 久久99热这里只频精品6 | 一级毛片全部免 | 老师小扫货水能么多叫出来 | 97视频在线观看免费视频 | AV无码久久无遮挡国产麻豆 | 高清无码中文字幕在线观看视频 | 2020久久精品永久免费 | 高清国产一区 | 一道精品视频一区二区三区 | 香港论理午夜电影网 | AV国产乱码一区二区三视频 | 99视频精品国产在线视频 | 最新国自产拍天天更新 | 国产成人自拍视频在线观看 | 嫩交18xxxx| 亚洲日韩视频免费观看 | 午夜AV内射一区二区三区红桃视 | 快播官方网站 | 伦理片2499电影伦理片 | 精品国产成a人在线观看 | 日本妈妈在线观看中文字幕 | 美女撒尿无遮挡免费中国 | 美女被男人撕衣舔胸 | 午夜国产免费视频亚洲 | 国产一区精选播放022 | 欧美午夜福利主线路 | 国产国产成人人免费影院 | 毛片视频大全 | 狠狠色狠狠色综合曰曰 | 国产不卡一卡2卡三卡4卡网站 |