在主页面中动态加载PHP

在主页面中动态加载PHP

本文介绍了在主页面中动态加载PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在涉及PHP和AJAX方面,我还很陌生,所以我一直遇到问题,在网上搜寻创意后,我提出了一些建议.我正在寻找一种在一个主页上动态加载内容(PHP/HTML混合)的方法.主页将包含导航,并且一旦单击该导航中的链接,主内容div中的内容就会更改.很简单,对,但是我在这个话题上一直做得很努力.

I'm pretty new when it comes to PHP and AJAX, so I keep running into issues, and after scouring the web for ideas, I've come up short. I'm looking for a method to dynamically load content (PHP/HTML mixture) on one main page. The main page would include navigation, and once a link within this navigation is clicked, the content in the main content div would change. Pretty simple, right, but I've been a big struggle bus on this topic.

到目前为止,我最喜欢的方法是CSS-Tricks 重新思考使用HTML5历史记录API的动态页面替换内容.我喜欢它允许使用后退和前进浏览器按钮,但是我无法在Chrome中使用它.

The method I've liked the best so far is CSS-Tricks Rethinking Dynamic Page Replacing Content which uses the HTML5 History API. I liked that it allowed the use of the back and forward browser buttons, but I could not get it to work in Chrome.

这不是您通常遇到的帮助我弄清楚我的代码有什么问题"的问题,因此我事先表示歉意.通常,我正在寻找有关如何最好地找到该问题的解决方案的建议.

This isn't your typical "help me figure out what's wrong with my code" question, so I apologize in advance. Mostly I'm looking for a bit of advice on how best to find a solution to this problem.

推荐答案

使用Ajax ...两周前,我也遇到了类似情况.我对此了解不多,但是此站点非常有帮助: http://www.w3schools.com/ajax/ajax_example.asp

Go with Ajax... I was in a similar situation a couple of weeks ago. I didn't know much about it, but this site is quite helpful:http://www.w3schools.com/ajax/ajax_example.asp

它有一些简单的示例,可以帮助您了解呼叫的工作方式.希望对您有所帮助.由于您对应用程序的解释不多,因此很难给出更具体的建议.

It has simple examples that will help you to understand how the calls work.I hope it helps. It is difficult to give more specific advice since you don't explain much about your application.

这篇关于在主页面中动态加载PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 20:57