如何在包含的 PHP 页面处理/加载时显示 Prelaoder/加载动画/gif/百分比?
我在 PHP 主页面中包含了一个 PHP 脚本。
帮助我“如何在包含的 PHP 脚本处理和加载时显示预加载/加载动画或 gif 或 swf 或简单的加载百分比?” 这是我想要显示相同内容的代码片段(请参阅最后一行代码):
<body onLoad="document.forms.form1.from.focus()">
<font face="Calibri">
<table cellpadding="10">
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" name="form1">
<tr>
<td width='25%'>
<fieldset>
<legend>Enter From & To Date</legend>
<table border='0'>
<tr>
<td>From </td>
<td><input type="text" name="from" /></td>
</tr>
</fieldset>
<input type="submit" name="submit" value="Submit" />
</td>
</tr>
</form>
</table>
<?
//Form submitted
if(isset($_POST['submit']))
{
//No errors, process
if(!@is_array($error))
{
HERE IS WHERE I WANT THE LOADING TO TAKE PLACE
//HERE I INCLUDE THE SCRIPT
另外,如果我可以延迟 PHP 脚本的显示,直到它完成处理。
I'm including a PHP script with in a main PHP page.
Help me "how to show a Preloader/loading animation or gif or swf or simply percentage of loading while the included PHP script processes & loads?"
Here is the code snippet where I want to show the same (See the last line of code):
<body onLoad="document.forms.form1.from.focus()">
<font face="Calibri">
<table cellpadding="10">
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" name="form1">
<tr>
<td width='25%'>
<fieldset>
<legend>Enter From & To Date</legend>
<table border='0'>
<tr>
<td>From </td>
<td><input type="text" name="from" /></td>
</tr>
</fieldset>
<input type="submit" name="submit" value="Submit" />
</td>
</tr>
</form>
</table>
<?
//Form submitted
if(isset($_POST['submit']))
{
//No errors, process
if(!@is_array($error))
{
HERE IS WHERE I WANT THE LOADING TO TAKE PLACE
//HERE I INCLUDE THE SCRIPT
Also, if i can delay the display of the PHP script until it completes processing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将包含加载屏幕的
放在
之后(或者至少在耗时的加载发生之前)。在最后(或者在应该被加载屏幕覆盖的长部分之后)添加一些 JavaScript 来隐藏/删除包含加载屏幕的 div。
Put a
<div>
containing your loading screen right after the<body>
(or at least before the time-consuming loading happens). At the very end (or after the long part which should be covered by the loading screen) add some JavaScript to hide/remove the div containing the loading screen.这是我从互联网上下载的脚本的修改版本。不记得我从哪里得到它抱歉。
This is my modified version of a script I got off the internet. Cant remember where I got it from sorry.