1.1一个典型的HTML页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional// EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en">
<head>
<meta http-equiv="content-type" content ="text/html; charset=utf-8" />
<title>First PHP Script</title>
</head>
<body>
<?php phpinfo();
?>
</body>
</html>
PHP代码放置在<?php
More Html
?>之间http://localhost:3000/phpinfo.php
1.2 使用FTP
如果使用服务器学习,可以安装FTP,更新上传文件,否则可省这一步。
FileZilla(http://filezilla-project.org/)
sudo apt-get update
sudo apt-get install filezilla
或者安装参考:
https://blog.csdn.net/dally2/article/details/131930540
1.3 在浏览器中测试
新建一个HTML文档,命名为hello.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional// EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en">
<head>
<meta http-equiv="content-type" content ="text/html; charset=utf-8" />
<title>Hello,world!</title>
</head>
<body>
<p>
The following was created by PHP:
<?php
print "Hello,world!";
//print "<span style=\"font-weight:bold";\">Hello,world!</span>";
?>
</p>
</body>
</html>
1.4 php使用手册
www.php.net/print
1.5 注释方法
//单行注释
/*
*多行注释
*/
参考
PHP for the Web: Visual QuickStart Guide (5th Edition) | Larry Ullman
GitHub - LarryUllman/phpvqs-5ed: PHP for the Web: ,Visual QuickStart GuideGitHub - LarryUllman/phpvqs-5ed: PHP for the Web: ,