dongyoulou4829 2015-03-11 19:50
浏览 87
已采纳

结合PHP和SSI?

I have a simple goal but I'm having some issues. To save on bandwidth, I'm attempting to make "index.php" load up the separate parts of the page and then when people select areas of the site from the navbar, JUST the middle content changes.. As it stands, the files just have an echo statement to see if anything shows up - but nothing so far. I read about server side includes but I thought that I might be able to do it strictly with PHP. Is this a proper way to address my goal? What am I missing here? Do you need more info? Thanks so much for your time and help! :D

index.php

<html>
<body>
<?php include 'header-navbar.php' ; ?>
<?php include 'content.php' ; ?>
<?php include 'footer.php' ; ?>
</body>
</html>
  • 写回答

2条回答 默认 最新

  • dousenjue3214 2015-03-11 19:56
    关注

    You are kind of mixing concerns here. PHP shouldn't be concerned about the display on the client. That is the job of the HTML, JS, CSS, etc. To achieve what you are asking for you should read up on AJAX. It will allow you to load / reload specific sections of the page on the client without refreshing the entire page.

    The thing you need to keep in mind is that regardless of what you cache at the server the same content is going to be sent back for the page. Anything you cache on the server side will have no effect on the amount of bandwidth used to load the page.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改