- PHP手册
- HelloWorld
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> /* css */ </style> <script> // js </script> </head> <body> <?php echo 'hello world'; ?> </body> </html>
- demo 效果:
- phpinfo()
查看php信息
<?php phpinfo(); ?>
- PHP标记形式
PHP语言,是一种可以嵌入到“htm1"代码中的后台处理语言(程序) 有以下几种标记形式,只推荐第- -种。
- 1、 推荐写法!
- 2、
- 3、
- 4、 php代码写在这里... ?> 需要到php. ini中进行配置: shortopentag = On 默认为Off, 表示不能用该形式。
; This directive determines whether or not PHP will recognize code between ; <? and ?> tags as PHP source which should be processed as such. It is ; generally recommended that <?php and ?> should be used and that this feature ; should be disabled, as enabling it may result in issues when generating XML ; documents, however this remains supported for backward compatibility reasons. ; Note that this directive does not control the <?= shorthand tag, which can be ; used regardless of this directive. ; Default Value: On ; Development Value: Off ; Production Value: Off ; http://php.net/short-open-tag short_open_tag = Off
- PHP语法结束符 使用英文分号 ";" 表示一条语句的结束。