在JetBrains PhpStorm 2018.3.5软件中新建PHP.Flie
将里面的东西全部删除
打!摁TAB出现HTML基本代码`
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
</body>
</html>
在body部分输入<?php?>
在里面打PHP代码。
下面是一个用这种办法打的一个文件实现物品的新老价格
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<?php
$arr=["name"=>"草莓","price"=>50,"price_old"=>90];
$str_html="<table border='1'>
<tr>
<td>name</td>
<td>price</td>
<td>price_old</td>
</tr>
<tr>
<td>{$arr['name']}</td>
<td>{$arr['price']}</td>
<td>{$arr['price_old']}</td>
</tr>
</table>
echo $str_html;
?>
</body>
</html>