天天躁日日躁狠狠躁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;
//輸出簡寫
<?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
?>

以下是官方手冊說明:
Definition and Usage
定義和用法
The echo() function outputs one or more strings.
echo()函數(shù)的作用是:輸出一個或多個字符串。
Syntax
語法
echo(strings)
Parameter參數(shù) Description描述
strings Required. One or more strings to be sent to the output
必要參數(shù)。指定一個或多個需要被發(fā)送到結(jié)果中的字符串
Tips and Notes
提示和注意點
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ù)不是一個真正意義上的函數(shù),所以你沒有必要一定去使用它。如果你想把多于一個的參數(shù)傳遞給echo()函數(shù),那么使用圓括號“()”將產(chǎn)生錯誤。
Tip: The echo() function is slightly faster than print().
提示:echo()函數(shù)相當(dāng)于print()函數(shù)的簡化版本。
Tip: The echo() function has the following shortcut syntax. See example 5.
提示:echo()函數(shù)包含下面的簡便寫法。具體見:案例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ū)別單引號(')和雙引號(”)的不同。單引號將輸出變量名,而不是變量的值:
復(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:
簡寫(捷徑)語法:
復(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)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 亚洲日韩中文字幕区 | 99视频在线免费 | 九九99亚洲精品久久久久 | 月夜直播视频免费观看 | 97在线视频免费播放 | 精精国产www视频在线观看免费 | 97色在线视频 | 亚洲伊人久久综合影院2021 | 一本道亚洲区免费观看 | 狠狠色欧美亚洲狠狠色www | 久久天天躁狠狠躁夜夜躁 | 玖玖热视频一区二区人妻 | 久久精品热99看二 | 亚洲国产中文字幕在线视频 | 青青久久精品 | 日韩精品无码视频一区二区蜜桃 | 亚洲免费国产在线日韩 | 国家产午夜精品无人区 | 色即是空 BT | 成人免费观看在线视频 | 老头扒开粉缝亲我下面 | 国产成人精品免费视频大全可播放的 | 亚洲嫩草AV永久无码精品无码 | 在线看片福利无码网址 | 欧洲美女高清一级毛片 | 欧美极品尿交 | 三级黃60分钟| 一攻多受h嗯啊巨肉bl巨污 | 亚洲h视频在线观看 | 国产国拍亚洲精品av麻豆 | 久久影院中文字幕 | 艺术片 快播 | 色偷偷男人的天堂a v | 欧美高清一区二区三 | 色综合伊人色综合网站下载 | 67194免费入口| 国产精品久AAAAA片 | 免费看片A级毛片免费看 | 9位美女厕所撒尿11分 | 日本红怡院亚洲红怡院最新 | 一色屋精品亚洲香蕉网站 |