根据需要在HTML中运行PHP脚本 [英] Run PHP script inside HTML on demand
问题描述
你好!
我,一些家人和朋友一起创办了投资组合。现在我正在建立一个网站,以实时显示投资组合的价值。我设法创建了一个脚本,用PHP独立收集所有股票的价值。现在,我想在HTML中运行此脚本。我的意思是,例如我设置$ url = ASpecificStock'sURL,然后使用PHP代码运行脚本并在我的HTML脚本中设置值,然后设置$ url = AnotherSpecificStock'sURL并再次运行脚本。这可能吗?
澄清:我正在寻找运行外部PHP脚本的某种命令,如果存在的话?
提前谢谢
Hello!
Me, some family and friends have started an investment portfolio together. Now I'm making a website to display the value of the portfolio in real-time. I managed to create a script which gathers the value of all the stocks independently with PHP. Now, I would like to run this script inside the HTML. What I mean is that for example I set $url = ASpecificStock'sURL and then run the script with the PHP code and set the values inside my HTML script, then set $url = AnotherSpecificStock'sURL and run the script again. Is this possible?
To clarify: I'm looking for some kind of command that runs an external PHP script, if such exists?
Thank you in advance
推荐答案
url = ASpecificStock'sURL然后用PHP代码运行脚本并设置我的内部值HTML脚本,然后设置
url = ASpecificStock'sURL and then run the script with the PHP code and set the values inside my HTML script, then set
url = AnotherSpecificStock'sURL并再次运行脚本。这可能吗?
澄清:我正在寻找运行外部PHP脚本的某种命令,如果存在的话?
提前谢谢
url = AnotherSpecificStock'sURL and run the script again. Is this possible?
To clarify: I'm looking for some kind of command that runs an external PHP script, if such exists?
Thank you in advance
不确定我是否收到您的问题,但如果您想从HTML调用PHP脚本,可以使用我不喜欢的JavaScript认为是安全的。其他工作将是AJAX。看看问题,IMO AJAX将是救援人员。希望它可以帮助!!!
Not sure if I get your question but if you want to call PHP script from HTML it is possible using javascript which I don't think would be secure. Other work around would be AJAX. Looking at the problem IMO AJAX would be the one to the rescue. Hope it might help!!!
这篇关于根据需要在HTML中运行PHP脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!