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条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!