当前位置: 首页 > 图文教程 > 网络编程 > PHP > PHP 新手总结的 PHP 基础知识
| <scriptlanguage="php"> //嵌入方式一 echo("test\"); </script> <? //嵌入方式二 echo"<br>test2"; ?> <?php //嵌入方式三 echo"<br>test3"; ?> |
<? //这里是单行注释 echo"test"; /* 这里是多行注释!可以写很多行注释内容 */ ?> |
| <? $a=1; functiontest(){ echo$a; } test();//这里将不能输出结果“1”。 functiontest2(){ global$a; echo$a; } test2();//这样可以输出结果“1”。 ?> |
<? //变量的变量 $a="hello"; $$a="world"; echo"$a$hello";//将输出"helloworld" echo"$a${$a}";//同样将输出"helloworld" ?>![]() <? //变量的函数![]() functionfunc_1(){ print("test"); }![]() functionfun($callback){ $callback(); |