php能否将页面分成小块并逐渐显示?
php能否将页面分成小块并逐渐显示? 我将我的主页分成了几个小块,例如:
<?php
include('header.php');
<div id="content">
<!-- some content -->
</div>
include('partone.php');
include('parttwo.php');
include('partthree.php');
include('footer.php');
?>
我需要打开页面,首先加载header.php
,div#content
,footer.php,然后逐渐加载
partone.php
、parttwo.php
、partthird.php
。有没有办法可以做到这一点?谢谢。
Can php divide the page into small block and gradually appear?
I divided my main page into several small blocks, like:
<?php
include('header.php');
<div id="content">
<!-- some content -->
</div>
include('partone.php');
include('parttwo.php');
include('partthree.php');
include('footer.php');
?>
I need open the page, first load header.php
, div#content
, footer.php
, then gradually loaded partone.php
, parttwo.php
, partthree.php
. Is there a way could do that? thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
PHP 在服务器端执行,因此您的代码将包含列出的所有文件,并将整个输出立即发送到客户端计算机。
如果您希望一次只显示页面的部分内容,请尝试将它们包含在
div
中并使用 JavaScript。PHP is executed server side, so your code will include all the files listed, and send the entire output to the client computer at once.
If you want only parts of the page to appear at a time, try enclosing them in
div
s and use JavaScript.听起来你应该使用 javascript 来做到这一点。
看一下 jQuery get 方法。
Sounds like you should be using javascript to do this.
Have a look at the jQuery get method.
这可能就是您想要的: http://www.webresourcesdepot .com/load-content-while-scrolling-with-jquery/
演示:http://www .webresourcesdepot.com/dnspinger/
This might be what you're after: http://www.webresourcesdepot.com/load-content-while-scrolling-with-jquery/
Demo: http://www.webresourcesdepot.com/dnspinger/
将代码修改为如下所示
然后发出 3 个 ajax 请求,将partone.php、parttwo.php 和part Three.php 加载到上述代码中各自的div。有大量关于如何通过所有不同的 javascript 框架执行此操作的教程。我个人使用jquery,但你可以使用你喜欢的任何东西。
Modify your code to look like the following
Then make 3 ajax requests to load in partone.php, parttwo.php and partthree.php to their respecitve divs in the above code. Plenty of tutorials on how to do this via all the different javascript frameworks out there. Personally I use jquery, but you can use whatever is your preference for this.