将我的HTML网站转换为PHP后出现问题(echo''; echo'';无处不在)

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (58)

我试图将我的静态html网站页面转换为在线HTML到PHP转换器。我将所有扩展名更改为.php以及链接。您可以在下面看到转换结果。我用wamp运行它,但页面的一些东西(图像,CSS,文本)显示在浏览器中,但大多数东西不是,而是我看到

“; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声''; 回声'

我究竟做错了什么?

<? php
echo '<!DOCTYPE html>';
echo '<html lang="en">';

echo '<head>';
echo '<meta charset="utf-8">';
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
echo '<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->';
echo '<title>Title</title>';

echo '<!-- Bootstrap -->';
echo '<link href="css/bootstrap.min.css" rel="stylesheet">';
echo '<link rel="stylesheet" type="text/css" href="css/style.css">';

echo '<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->';
echo '<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->';
echo '<!--[if lt IE 9]>';
echo '<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>';
echo '<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>';
echo '<![endif]-->';
echo '</head>';
echo '<body>';
echo '<nav class="navbar navbar-default">';
echo '<div class="container">';
echo '<!-- Brand and toggle get grouped for better mobile display -->';
echo '<div class="navbar-header">';
echo '<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">';
echo '<span class="sr-only">Toggle navigation</span>';
echo '<span class="icon-bar"></span>';
echo '<span class="icon-bar"></span>';
echo '<span class="icon-bar"></span>';
echo '</button>';
echo '<a class="navbar-brand" href="index.php"><img src="images/logo.png" class="img-responsive" width="150px"></a>';
echo '</div>';

echo '<!-- Collect the nav links, forms, and other content for toggling -->';
echo '<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">';
echo '<ul class="nav navbar-nav navbar-right">';
echo '<li class="active"><a href="index.php">HOME <span class="sr-only">(current)</span></a></li>';

echo '<li class="dropdown">';
echo '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">text <span class="caret"></span></a>';
echo '<ul class="dropdown-menu">';

echo '<li><a href="one.php">some link</a></li>';
echo '<li role="separator" class="divider"></li>';
echo '<li><a href="two.php">something</a></li>';
echo '<li role="separator" class="divider"></li>';
echo '<li><a href="three.php">something else</a></li>';
echo '</ul>';
echo '</li>';
echo '<li class="dropdown">';
echo '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">something<span class="caret"></span></a>';
echo '<ul class="dropdown-menu">';
echo '<li><a href="four.php">something</a></li>';
echo '<li role="separator" class="divider"></li>';
echo '<li><a href="five.php">some link</a></li>';
echo '<li role="separator" class="divider"></li>';
echo '<li></><a href="six.php"> something</a></li>';
echo '<li role="separator" class="divider"></li>';
echo '<li></><a href="seven.php">something</a></li>';
echo '</ul>';
echo '</li>';


echo '<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">something<span class="caret"></span></a>';
echo '<ul class="dropdown-menu">';
echo '<li><a href="eight.php">something</a></li>';
echo '<li role="separator" class="divider"></li>';
echo '<li><a href="nine.php">something</a></li>';
echo '<li role="separator" class="divider"></li>';
echo '<li></><a href="ten.php">something</a></li>';
echo '<li role="separator" class="divider"></li>';
echo '<li></><a href="elevne.php">something</a></li>';
echo '</ul>';
echo '</li>';


echo '</ul>';
echo '</div><!-- /.navbar-collapse -->';
echo '</div><!-- /.container-->';
echo '</nav>';
echo '<!-- Carousal -->';


echo '<section class="jk-slider">';
echo '<div id="carousel-example" class="carousel slide" data-ride="carousel">';
echo '<ol class="carousel-indicators">';
echo '<li data-target="#carousel-example" data-slide-to="0" class="active"></li>';
echo '<li data-target="#carousel-example" data-slide-to="1"></li>';
echo '<li data-target="#carousel-example" data-slide-to="2"></li>';
echo '</ol>';

echo '<div class="carousel-inner">';

echo '<div class="item active">';
echo '<div class="hero">';
echo '<hgroup>';
echo '<p>something</p>';

echo '</hgroup>';
echo '</div>';
echo '<div class="overlay"></div>';
echo '<a href="#"><img src="images/1.jpg" class="img-responsive" width="100%"></a>';
echo '</div>';
echo '<div class="item">';
echo '<div class="hero">';
echo '<hgroup>';
echo '<p>something</p>';

echo '</hgroup>';
echo '</div>';
echo '<div class="overlay"></div>';
echo '<a href="#"><img src="images/2.jpg" class="img-responsive" width="100%"></a>';
echo '</div>';
echo '<div class="item">';
echo '<div class="hero">';
echo '<hgroup>';
echo '<p>something</p>';

echo '</hgroup>';
echo '</div>';
echo '<div class="overlay"></div>';
echo '<a href="#"><img src="images/3.jpg" /></a>';
echo '</div>';
echo '</div>';
echo '<a class="left carousel-control" href="#carousel-example" data-slide="prev">';
echo '<span class="glyphicon glyphicon-chevron-left"></span>';
echo '</a>';
echo '<a class="right carousel-control" href="#carousel-example" data-slide="next">';
echo '<span class="glyphicon glyphicon-chevron-right"></span>';
echo '</a>';
echo '</div>';
echo '</section>';
echo '<!-- End Of carousal -->';

echo '<section>';
echo '<div class="container">';
echo '<div class="row">';
echo '<div class="col-md-12">';
echo '&nbsp;';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</section>';


echo '<script src="../../ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>';
echo '<!-- Include all compiled plugins (below), or include individual files as needed -->';
echo '<script src="js/bootstrap.min.js"></script>';
echo '<script type="text/javascript">';
echo '<script type="text/javascript">';

echo '$('.count').each(function () {';
echo '$(this).prop('Counter',0).animate({';
echo 'Counter: $(this).text()';
echo '}, {';
echo 'duration: 5000,';
echo 'easing: 'swing',';
echo 'step: function (now) {';
echo '$(this).text(Math.ceil(now));';
echo '}';
echo '});';
echo '});';
echo '</script>';

echo '</script>';
echo '</body>';


echo '</html>';
?>
提问于
用户回答回答于

你真的需要把一切都搞定echo吗?你可以简单地放入普通html标签。并放在<?php ?>任何需要PHP代码的地方。

关于你的JS,你要调用两次<script type='text/javascript'></script>

扫码关注云+社区

领取腾讯云代金券

年度创作总结 领取年终奖励