如题所述
标签<?php ?>中的是php代码,文件必须是php文件!html页面嵌套php,你php代码有什么用,能执行?这都满意,无言了
温馨提示:答案为网友推荐,仅供参考
第1个回答 2018-05-09
<!--这里模拟了后台传输的数据-->
<?php
$title = "这是一个标题";
$type = array("html","css","js","php");
$data = "这是一条数据";
$content = "这是内容";
?>
<!--这里是前端代码-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?php echo $title; ?></title>
</head>
<body>
<ul>
<?php foreach ($type as $value){echo "<li>$value</li>";} ?>
</ul>
<h1><?php echo $data; ?></h1>
<div><?php echo $content; ?></div>
</body>
</html>
<?php
$title = "这是一个标题";
$type = array("html","css","js","php");
$data = "这是一条数据";
$content = "这是内容";
?>
<!--这里是前端代码-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?php echo $title; ?></title>
</head>
<body>
<ul>
<?php foreach ($type as $value){echo "<li>$value</li>";} ?>
</ul>
<h1><?php echo $data; ?></h1>
<div><?php echo $content; ?></div>
</body>
</html>
第2个回答 推荐于2016-04-19
html页面嵌套php
<div class="c2">
<input type="text" name="name" value="<?php echo 123; ?>" class="text" style="width: 400px;" onKeyUp="this.className='text';expert_info.text_length(this,15);" onfocus="this.className='text2'" />
<span id="expert_name_tips" style="color: #ccc;font-size: 12px;font-weight: normal;"></span>
</div>本回答被提问者和网友采纳
<div class="c2">
<input type="text" name="name" value="<?php echo 123; ?>" class="text" style="width: 400px;" onKeyUp="this.className='text';expert_info.text_length(this,15);" onfocus="this.className='text2'" />
<span id="expert_name_tips" style="color: #ccc;font-size: 12px;font-weight: normal;"></span>
</div>本回答被提问者和网友采纳