After reading some basic knowledge of PHP, I summarized it here:
1. There are three ways to embed PHP scripts in HTML:
echo("test"); </script> <? //Embedding method two
?> <?php //Embedding method three echo"<br>test3"; ?> |
<? //This is a single line comment |
<? $a=1; functiontest(){ echo$a; } test();//这里将不能输出结果“1”。 functiontest2(){ global$a; echo$a; } test2();//这样可以输出结果“1”。 ?> |
<? $a=1; functiontest(){ echo$a; } test();//The result "1" will not be output here. functiontest2(){ global$a; echo$a; } test2();//This can output the result "1". ?> |
<?
|
|
<? $a[0]="abc"; $a[1]="def"; $b["foo"]=13; $a[]="hello";//$a[2]="hello" $a[]="world";//$a[3]="world" $name[]="jill";//$name[0]="jill" $name[]="jack";//$name[1]="jack" ?> |
<? $a[0]="abc"; $a[1]="def"; $b["foo"]=13; $a[]="hello";//$a[2]="hello" $a[]="world";//$a[3]="world" $name[]="jill";//$name[0]="jill" $name[]="jack";//$name[1]="jack" ?> |
<? //Method 1: functionfoo(&$bar){
http://www.bkjia.com/PHPjc/508486.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508486.htmlTechArticleAfter reading some basic knowledge of PHP, I will summarize it here: 1. There are three ways to embed PHP scripts in HTML : <scriptlanguage=php> //Embedding method: echo(test); </script> <? //Embedding...
|