从PHP更新网页 [英] Update web page from PHP

查看:54
本文介绍了从PHP更新网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图找到一种方法来使用PHP程序中的数据更新当前网页 - 但没有成功。 (搜索此论坛没有成功)现在寻求一些帮助。


解释..我有一个调用php程序的页面需要很长时间才能完成,所以我想要在页面上显示php的进度。即状态:第一部分......然后当那样做改变''第一部分''到''第二部分'等我不想继续在网页上添加行,我想改变页面。


我希望你明白我的意思,可以提供帮助。我在想这个解决方案将是Javascript和PHP的混合......我对两者都很新。

I have been trying to find a way to update the current web page with data from a PHP program - without success. (searched this forum without success) Looking for some help now.

To explain.. I have a page that calls a php program that will take quite a while to complete, so I want to display on the page the progress of the php. ie Status: Part One.. then when thats done CHANGE ''Part One'' to ''Part Two'' etc. I do NOT want to keep adding lines to the web page, I want to ALTER the page.

I hope you understand what I mean and can help. I''m thinking that the solution will be a mix of Javascript and PHP.. I''m fairly new to both.

推荐答案

如果你想更新你的从服务器不断页面,你需要Ajax。如果你只是想在客户端做到这一点,你需要JS来做到这一点。这些是一个加载栏的JS + CSS + DHTML示例(加上源代码),您可以根据自己的意愿改变进度条


罗纳德:酷:
If you want to update your page continually from the server, you''ll need Ajax. If you just want to do it at the client-side you''ll need JS to do that. These is a JS+CSS+DHTML sample (plus source) of a loading bar what you could change to your wishes at progress bar

Ronald :cool:


罗纳德:


感谢链接..这虽然引发了一个问题..它说:
Ronald:

Thanks for the link.. This though raises a problem .. It says :

:只要你想要调用moveProgressBar()函数移动进度条
:The moveProgressBar() function is called whenever you want to move the progress bar



因为我正在运行一个php程序,它是从那里我需要调用该函数,它自然是在网站的主页面。我一直在寻找''如何从PHP脚本调用javascript函数''...没有成功..然后,如果这是可能的,为什么我不能在php中设置var或session var并通过函数传递?哪个原因会回答我的问题并解决问题。


无处不在,我似乎得到了一半答案。这告诉我调用一个函数但没告诉我该怎么做。有点像说''如果你想去月球建造火箭''或者我在这里遗漏了什么?

As I am running a php program, it is from there that I need to call the function, which naturally is in the main page on the site. I have been searching for ''how to call a javascript function from a PHP script'' ... without success.. Then if this is possible why can I not set a var or session var in the php and pass that through a function ? Which would of cause answer my query and solve the problem.

Everywhere I go I seem to get a half answer. This tells me to call a function but fails to tell me how to do it. Bit like saying ''If you want to go to the moon build a rocket'' Or am I missing something here?


因为你正在运行PHP程序并且该程序更新了HTML页面在客户端,完全取决于您何时显示栏以及间隔时间。我没有看到问题。但我在phpclasses.org上找到了几个PHP类。其中一个必须满足要求。它们是:

进度条
ProgressBar(与上述不同)
PHProgress Bar
<祝你好运!祝你好运!


罗纳德:酷:
Since you are running the PHP program and that program updates the HTML page at the client, it is all up to you when to display the bar and with what intervals. I don''t see the problem. But I have found a couple of PHP classes at phpclasses.org. One of them must satisfy the requirement. They are:

Progress Bar
ProgressBar (not the same as above)
PHProgress Bar

Good luck!

Ronald :cool:


这篇关于从PHP更新网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆